This commit is contained in:
Richard Newman 2012-04-25 18:55:05 -07:00
Родитель 3e09ffce38 fab0bd775f
Коммит 8981b46e22
540 изменённых файлов: 14111 добавлений и 38871 удалений

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

@ -797,10 +797,25 @@ interface nsIAccessibleRole : nsISupports
*/
const unsigned long ROLE_CHECK_RICH_OPTION = 125;
/**
* An HTML definition list <dl>
*/
const unsigned long ROLE_DEFINITION_LIST = 126;
/**
* An HTML definition term <dt>
*/
const unsigned long ROLE_TERM = 127;
/**
* An HTML definition <dd>
*/
const unsigned long ROLE_DEFINITION = 128;
/**
* It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized.
*/
const unsigned long ROLE_LAST_ENTRY = 126;
const unsigned long ROLE_LAST_ENTRY = 129;
};

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

@ -171,6 +171,9 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_SECTION, // roles::NOTE 123
ATK_ROLE_PANEL, // roles::FIGURE 124
ATK_ROLE_CHECK_BOX, // roles::CHECK_RICH_OPTION 125
ATK_ROLE_LIST, // roles::DEFINITION_LIST 126
ATK_ROLE_LIST_ITEM, // roles::TERM 127
ATK_ROLE_PARAGRAPH, // roles::DEFINITION 128
kROLE_ATK_LAST_ENTRY // roles::LAST_ENTRY
};

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

@ -798,11 +798,26 @@ namespace roles {
*/
CHECK_RICH_OPTION = 125,
/**
* Represent a definition list (dl in HTML).
*/
DEFINITION_LIST = 126,
/**
* Represent a term in a definition list (dt in HTML).
*/
TERM = 127,
/**
* Represent a definition in a definition list (dd in HTML)
*/
DEFINITION = 128,
/**
* It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized.
*/
LAST_ENTRY = 126
LAST_ENTRY = 129
};
} // namespace role
typedef enum mozilla::a11y::roles::Role role;

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

@ -426,6 +426,16 @@ nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent,
return accessible;
}
already_AddRefed<nsAccessible>
nsAccessibilityService::CreateHTMLTableRowAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
nsAccessible* accessible =
new nsEnumRoleAccessible(aContent, GetDocAccessible(aPresShell), roles::ROW);
NS_ADDREF(accessible);
return accessible;
}
already_AddRefed<nsAccessible>
nsAccessibilityService::CreateHTMLTextAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
@ -1684,13 +1694,6 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
return accessible;
}
if (tag == nsGkAtoms::tr) {
nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aDoc,
roles::ROW);
NS_IF_ADDREF(accessible);
return accessible;
}
if (nsCoreUtils::IsHTMLTableHeader(aContent)) {
nsAccessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent,
aDoc);

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

@ -131,6 +131,8 @@ public:
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
@ -423,7 +425,10 @@ static const char kRoleNames[][20] = {
"embedded object", //ROLE_EMBEDDED_OBJECT
"note", //ROLE_NOTE
"figure", //ROLE_FIGURE
"check rich option" //ROLE_CHECK_RICH_OPTION
"check rich option", //ROLE_CHECK_RICH_OPTION
"definitionlist", //ROLE_DEFINITION_LIST
"term", //ROLE_TERM
"definition" //ROLE_DEFINITION
};
/**

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

@ -1137,16 +1137,6 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
return;
}
// For aria drag and drop changes we fire a generic attribute change event;
// at least until native API comes up with a more meaningful event.
if (aAttribute == nsGkAtoms::aria_grabbed ||
aAttribute == nsGkAtoms::aria_dropeffect ||
aAttribute == nsGkAtoms::aria_hidden ||
aAttribute == nsGkAtoms::aria_sort) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
aContent);
}
// We treat aria-expanded as a global ARIA state for historical reasons
if (aAttribute == nsGkAtoms::aria_expanded) {
nsRefPtr<AccEvent> event =
@ -1155,6 +1145,13 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
return;
}
// For aria attributes like drag and drop changes we fire a generic attribute
// change event; at least until native API comes up with a more meaningful event.
PRUint8 attrFlags = nsAccUtils::GetAttributeCharacteristics(aAttribute);
if (!(attrFlags & ATTR_BYPASSOBJ))
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
aContent);
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
// We don't care about these other ARIA attribute changes unless there is
// an ARIA role set for the element

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

@ -84,43 +84,33 @@ ARIAGridAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleTable
NS_IMETHODIMP
ARIAGridAccessible::GetColumnCount(PRInt32* aColumnCount)
PRUint32
ARIAGridAccessible::ColCount()
{
NS_ENSURE_ARG_POINTER(aColumnCount);
*aColumnCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
AccIterator rowIter(this, filters::GetRow);
nsAccessible* row = rowIter.Next();
if (!row)
return NS_OK;
return 0;
AccIterator cellIter(row, filters::GetCell);
nsAccessible *cell = nsnull;
nsAccessible* cell = nsnull;
PRUint32 colCount = 0;
while ((cell = cellIter.Next()))
(*aColumnCount)++;
colCount++;
return NS_OK;
return colCount;
}
NS_IMETHODIMP
ARIAGridAccessible::GetRowCount(PRInt32* aRowCount)
PRUint32
ARIAGridAccessible::RowCount()
{
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint32 rowCount = 0;
AccIterator rowIter(this, filters::GetRow);
while (rowIter.Next())
(*aRowCount)++;
rowCount++;
return NS_OK;
return rowCount;
}
NS_IMETHODIMP

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

@ -71,6 +71,10 @@ public:
// nsAccessNode
virtual void Shutdown();
// TableAccessible
virtual PRUint32 ColCount();
virtual PRUint32 RowCount();
protected:
/**
* Return true if the given row index is valid.

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

@ -65,6 +65,7 @@ nsHTMLImageAccessible::
nsHTMLImageAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
nsLinkableAccessible(aContent, aDoc)
{
mFlags |= eImageAccessible;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageAccessible, nsAccessible,

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

@ -563,36 +563,24 @@ nsHTMLTableAccessible::Summary(nsString& aSummary)
table->GetSummary(aSummary);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumnCount(PRInt32 *acolumnCount)
PRUint32
nsHTMLTableAccessible::ColCount()
{
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = nsnull;
nsITableLayout* tableLayout = GetTableLayout();
if (IsDefunct())
return NS_ERROR_FAILURE;
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
PRInt32 rows;
return tableLayout->GetTableSize(rows, *acolumnCount);
PRInt32 rowCount = 0, colCount = 0;
tableLayout->GetTableSize(rowCount, colCount);
return colCount;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowCount(PRInt32 *arowCount)
PRUint32
nsHTMLTableAccessible::RowCount()
{
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
nsITableLayout* tableLayout = GetTableLayout();
if (IsDefunct())
return NS_ERROR_FAILURE;
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
PRInt32 columns;
return tableLayout->GetTableSize(*arowCount, columns);
PRInt32 rowCount = 0, colCount = 0;
tableLayout->GetTableSize(rowCount, colCount);
return rowCount;
}
NS_IMETHODIMP

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

@ -129,6 +129,8 @@ public:
// TableAccessible
virtual nsAccessible* Caption();
virtual PRUint32 ColCount();
virtual PRUint32 RowCount();
virtual void Summary(nsString& aSummary);
virtual bool IsProbablyLayoutTable();

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

@ -259,6 +259,9 @@ nsHTMLLIAccessible::Shutdown()
role
nsHTMLLIAccessible::NativeRole()
{
if (mContent->Tag() == nsGkAtoms::dt)
return roles::TERM;
return roles::LISTITEM;
}
@ -410,6 +413,9 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
role
nsHTMLListAccessible::NativeRole()
{
if (mContent->Tag() == nsGkAtoms::dl)
return roles::DEFINITION_LIST;
return roles::LIST;
}

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

@ -123,6 +123,9 @@ nsHyperTextAccessible::NativeRole()
{
nsIAtom *tag = mContent->Tag();
if (tag == nsGkAtoms::dd)
return roles::DEFINITION;
if (tag == nsGkAtoms::form)
return roles::FORM;

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

@ -467,36 +467,18 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
- (NSString*)subrole
{
if (!mGeckoAccessible)
return nil;
nsIContent* content = mGeckoAccessible->GetContent();
if (!content || !content->IsHTML())
return nil;
nsIAtom* tag = content->Tag();
switch (mRole) {
case roles::LIST:
if ((tag == nsGkAtoms::ul) || (tag == nsGkAtoms::ol))
return NSAccessibilityContentListSubrole;
return NSAccessibilityContentListSubrole;
if (tag == nsGkAtoms::dl)
return NSAccessibilityDefinitionListSubrole;
case roles::DEFINITION_LIST:
return NSAccessibilityDefinitionListSubrole;
break;
case roles::TERM:
return @"AXTerm";
case roles::LISTITEM:
if (tag == nsGkAtoms::dt)
return @"AXTerm";
break;
case roles::PARAGRAPH:
if (tag == nsGkAtoms::dd)
return @"AXDefinition";
break;
case roles::DEFINITION:
return @"AXDefinition";
default:
break;

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

@ -79,6 +79,8 @@ ToNSString(id aValue)
NSAccessibilityNumberOfCharactersAttribute, // required
NSAccessibilityVisibleCharacterRangeAttribute, // required
NSAccessibilityInsertionPointLineNumberAttribute,
@"AXRequired",
@"AXInvalid",
nil
];
[supportedAttributes addObjectsFromArray:[super accessibilityAttributeNames]];
@ -115,6 +117,12 @@ ToNSString(id aValue)
return [self text];
}
if ([attribute isEqualToString:@"AXRequired"])
return [NSNumber numberWithBool:!!(mGeckoAccessible->State() & states::REQUIRED)];
if ([attribute isEqualToString:@"AXInvalid"])
return [NSNumber numberWithBool:!!(mGeckoAccessible->State() & states::INVALID)];
if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute])
return [self visibleCharacterRange];

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

@ -168,5 +168,8 @@ static const NSString* AXRoles [] = {
NSAccessibilityGroupRole, // roles::NOTE 123
NSAccessibilityGroupRole, // roles::FIGURE 124
NSAccessibilityCheckBoxRole, // roles::CHECK_RICH_OPTION 125
NSAccessibilityListRole, // roles::DEFINITION_LIST 126
NSAccessibilityGroupRole, // roles::TERM 127
NSAccessibilityGroupRole, // roles::DEFINITION 128
@"ROLE_LAST_ENTRY" // roles::LAST_ENTRY Bogus role that will never be shown (just marks the end of this array)!
};

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

@ -452,6 +452,15 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
// roles::CHECK_RICH_OPTION
{ ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
// roles::DEFINITION_LIST
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// roles::TERM
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::DEFINITION
{ USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
// roles::LAST_ENTRY
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
};

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

@ -21,6 +21,32 @@ xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
return NS_OK;
}
nsresult
xpcAccessibleTable::GetColumnCount(PRInt32* aColumnCount)
{
NS_ENSURE_ARG_POINTER(aColumnCount);
*aColumnCount = 0;
if (!mTable)
return NS_ERROR_FAILURE;
*aColumnCount = mTable->ColCount();
return NS_OK;
}
nsresult
xpcAccessibleTable::GetRowCount(PRInt32* aRowCount)
{
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
if (!mTable)
return NS_ERROR_FAILURE;
*aRowCount = mTable->RowCount();
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSummary(nsAString& aSummary)
{

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

@ -23,6 +23,8 @@ public:
xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
nsresult GetCaption(nsIAccessible** aCaption);
nsresult GetColumnCount(PRInt32* aColumnCount);
nsresult GetRowCount(PRInt32* aRowCount);
nsresult GetSummary(nsAString& aSummary);
nsresult IsProbablyForLayout(bool* aIsForLayout);
@ -35,8 +37,10 @@ protected:
{ return xpcAccessibleTable::GetCaption(aCaption); } \
NS_SCRIPTABLE NS_IMETHOD GetSummary(nsAString & aSummary) \
{ return xpcAccessibleTable::GetSummary(aSummary); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32 *aColumnCount); \
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32 *aRowCount); \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32* aColumnCount) \
{ return xpcAccessibleTable::GetColumnCount(aColumnCount); } \
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32* aRowCount) \
{ return xpcAccessibleTable::GetRowCount(aRowCount); } \
NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible * *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \

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

@ -241,15 +241,9 @@ nsXULListboxAccessible::NativeRole()
////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessible. nsIAccessibleTable
NS_IMETHODIMP
nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
PRUint32
nsXULListboxAccessible::ColCount()
{
NS_ENSURE_ARG_POINTER(aColumnsCout);
*aColumnsCout = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsIContent* headContent = nsnull;
for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
childContent = childContent->GetNextSibling()) {
@ -259,7 +253,7 @@ nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
}
}
if (!headContent)
return NS_OK;
return 0;
PRUint32 columnCount = 0;
for (nsIContent* childContent = headContent->GetFirstChild(); childContent;
@ -270,28 +264,19 @@ nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
}
}
*aColumnsCout = columnCount;
return NS_OK;
return columnCount;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetRowCount(PRInt32 *aRowCount)
PRUint32
nsXULListboxAccessible::RowCount()
{
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULSelectControlElement> element(do_QueryInterface(mContent));
NS_ENSURE_STATE(element);
PRUint32 itemCount = 0;
nsresult rv = element->GetItemCount(&itemCount);
NS_ENSURE_SUCCESS(rv, rv);
if(element)
element->GetItemCount(&itemCount);
*aRowCount = itemCount;
return NS_OK;
return itemCount;
}
NS_IMETHODIMP

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

@ -104,6 +104,10 @@ public:
// nsIAccessibleTable
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// TableAccessible
virtual PRUint32 ColCount();
virtual PRUint32 RowCount();
// nsAccessNode
virtual void Shutdown();

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

@ -72,32 +72,21 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeGridAccessible,
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible: nsIAccessibleTable implementation
NS_IMETHODIMP
nsXULTreeGridAccessible::GetColumnCount(PRInt32 *aColumnCount)
PRUint32
nsXULTreeGridAccessible::ColCount()
{
NS_ENSURE_ARG_POINTER(aColumnCount);
*aColumnCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aColumnCount = nsCoreUtils::GetSensibleColumnCount(mTree);
return NS_OK;
return nsCoreUtils::GetSensibleColumnCount(mTree);
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetRowCount(PRInt32* aRowCount)
PRUint32
nsXULTreeGridAccessible::RowCount()
{
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mTreeView)
return NS_OK;
return 0;
return mTreeView->GetRowCount(aRowCount);
PRInt32 rowCount = 0;
mTreeView->GetRowCount(&rowCount);
return rowCount >= 0 ? rowCount : 0;
}
NS_IMETHODIMP

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

@ -60,6 +60,10 @@ public:
// nsIAccessibleTable
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// TableAccessible
virtual PRUint32 ColCount();
virtual PRUint32 RowCount();
// nsAccessNode
virtual void Shutdown();

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

@ -109,6 +109,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
// no object attributes
testAbsentAttrs(getAccessible("listitem").firstChild, { "tag": "" });
// experimental aria
testAttrs("experimental", {"blah" : "true"}, true);
SimpleTest.finish();
}
@ -142,6 +145,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
title="Add test coverage for tablist as implicit live region">
Mozilla Bug 663136
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=563862"
title="Expand support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGE">
Mozilla Bug 563862
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -201,5 +209,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
<ul>
<li id="listitem">item
</ul>
<!-- experimental aria -->
<div id="experimental" aria-blah="true">Fake beer</div>
</body>
</html>

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

@ -21,7 +21,7 @@
*/
var gQueue = null;
function hideNode(aID, bHide)
function updateAttribute(aID, aAttr, aValue)
{
this.node = getNode(aID);
this.accessible = getAccessible(this.node);
@ -30,34 +30,14 @@
new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible),
];
this.invoke = function hideNode_invoke()
this.invoke = function updateAttribute_invoke()
{
this.node.setAttribute("aria-hidden", bHide);
this.node.setAttribute(aAttr, aValue);
}
this.getID = function hideNode_getID()
this.getID = function updateAttribute_getID()
{
return "aria-hidden for " + aID + " " + bHide;
}
}
function updateSort(aID, aSort)
{
this.node = getNode(aID);
this.accessible = getAccessible(this.node);
this.eventSeq = [
new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible),
];
this.invoke = function updateSort_invoke()
{
this.node.setAttribute("aria-sort", aSort);
}
this.getID = function updateSort_getID()
{
return "aria-sort for " + aID + " " + aSort;
return aAttr + " for " + aID + " " + aValue;
}
}
@ -69,9 +49,12 @@
{
gQueue = new eventQueue();
gQueue.push(new hideNode("hideable", "true"));
gQueue.push(new updateAttribute("hideable", "aria-hidden", "true"));
gQueue.push(new updateSort("sortable", "ascending"));
gQueue.push(new updateAttribute("sortable", "aria-sort", "ascending"));
// For experimental ARIA extensions
gQueue.push(new updateAttribute("custom", "aria-blah", "true"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -95,6 +78,12 @@
Mozilla Bug 640707
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=640707"
title="Expand support for aria attribute change events">
Mozilla Bug 563862
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -103,6 +92,8 @@
<div id="hideable"><div>Hi</div><div>there</div></div>
<div id="sortable" role="columnheader" aria-sort"none">aria-sort</div>
<div id="sortable" role="columnheader" aria-sort="none">aria-sort</div>
<div id="custom" role="custom" aria-blah="false">Fat free cheese</div>
</body>
</html>

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

@ -62,6 +62,7 @@
////////////////////////////////////////////////////////////////////////////
// Test
var gQueue = null;
gA11yEventDumpToConsole = true;
function doTest()
{
// Load documents into tabs and wait for DocLoadComplete events caused by

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

@ -16,6 +16,8 @@ const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
const ROLE_COLUMNHEADER = nsIAccessibleRole.ROLE_COLUMNHEADER;
const ROLE_DEFINITION = nsIAccessibleRole.ROLE_DEFINITION;
const ROLE_DEFINITION_LIST = nsIAccessibleRole.ROLE_DEFINITION_LIST;
const ROLE_DIALOG = nsIAccessibleRole.ROLE_DIALOG;
const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT;
const ROLE_EMBEDDED_OBJECT = nsIAccessibleRole.ROLE_EMBEDDED_OBJECT;
@ -62,6 +64,7 @@ const ROLE_SEPARATOR = nsIAccessibleRole.ROLE_SEPARATOR;
const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
const ROLE_TERM = nsIAccessibleRole.ROLE_TERM;
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;

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

@ -53,9 +53,9 @@
testRole("p", ROLE_PARAGRAPH);
// Test dl, dt, dd
testRole("definitionlist", ROLE_LIST);
testRole("definitionterm", ROLE_LISTITEM);
testRole("definitiondescription", ROLE_PARAGRAPH);
testRole("definitionlist", ROLE_DEFINITION_LIST);
testRole("definitionterm", ROLE_TERM);
testRole("definitiondescription", ROLE_DEFINITION);
// Has click, mousedown or mouseup listeners.
testRole("span1", ROLE_TEXT_CONTAINER);

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

@ -110,6 +110,7 @@
testStates("autocomplete-list", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-list2", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-tel", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-email", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
SimpleTest.finish();
}
@ -235,5 +236,12 @@
<input id="autocomplete-list2" list="cities" autocomplete="off">
<input id="autocomplete-tel" type="tel">
Email Address:
<input id="autocomplete-email" type="email" list="contacts" value="xyzzy">
<datalist id="contacts">
<option>xyzzy@plughs.com</option>
<option>nobody@mozilla.org</option>
</datalist>
</body>
</html>

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

@ -88,17 +88,17 @@
// dl list
var tree =
{ LIST: [ // dl
{ LISTITEM: [ // dt
{ DEFINITION_LIST: [ // dl
{ TERM: [ // dt
{ TEXT_LEAF: [] },
] },
{ PARAGRAPH: [ // dd
{ DEFINITION: [ // dd
{ TEXT_LEAF: [] }
] },
{ LISTITEM: [ // dt
{ TERM: [ // dt
{ TEXT_LEAF: [] }
] },
{ PARAGRAPH: [ // dd
{ DEFINITION: [ // dd
{ TEXT_LEAF: [] }
] }
] };
@ -110,11 +110,11 @@
{ LIST: [ // ol
{ LISTITEM: [ // li
{ STATICTEXT: [ ] },
{ LIST: [ // dl
{ LISTITEM: [ // dt
{ DEFINITION_LIST: [ // dl
{ TERM: [ // dt
{ TEXT_LEAF: [] }
] },
{ PARAGRAPH: [ // dd
{ DEFINITION: [ // dd
{ TEXT_LEAF: [] }
] }
] }

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

@ -128,6 +128,17 @@
testAccessibleTree("table3", accTree);
/////////////////////////////////////////////////////////////////////////
// table4 (display: table-row)
accTree =
{ TABLE: [
{ ROW: [
{ CELL: [
{ TEXT_LEAF: [ ] }
] }
] } ]
};
testAccessibleTree("table4", accTree);
SimpleTest.finish();
}
@ -142,6 +153,11 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=529621">
Mozilla Bug 529621
</a>
<a target="_blank"
title="when div has display style table-row"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=727722">
Mozilla Bug 727722
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -189,5 +205,11 @@
<td>cell</td>
</tr>
</table>
<table id="table4">
<div style="display: table-row">
<td>cell1</td>
</div>
</table>
</body>
</html>

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

@ -90,6 +90,19 @@
testAccessibleTree("txc6", accTree);
// input@type="email", value
accTree = {
role: ROLE_ENTRY,
children: [
{ // text child
role: ROLE_TEXT_LEAF,
children: []
}
]
};
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
@ -132,5 +145,12 @@
<input id="txc5" type="password" value="hello">
<input id="txc6" type="tel" value="4167771234">
Email Address:
<input id="txc7" type="email" list="contacts" value="xyzzy">
<datalist id="contacts">
<option>xyzzy@plughs.com</option>
<option>nobody@mozilla.org</option>
</datalist>
</body>
</html>

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

@ -380,7 +380,7 @@
}
}
//gA11yEventDumpToConsole = true;
gA11yEventDumpToConsole = true;
var gQueue = null;
function doTest()

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

@ -475,15 +475,6 @@ pref("full-screen-api.enabled", true);
pref("media.volume.steps", 10);
// Data connection settings. These will eventually live in the
// navigator.settings API, or even in a database where we can look
// it up automatically (bug 729440), but for this will have to do.
pref("ril.data.enabled", false);
pref("ril.data.roaming.enabled", false);
pref("ril.data.apn", "");
pref("ril.data.user", "");
pref("ril.data.passwd", "");
//Enable/disable marionette server, set listening port
pref("marionette.defaultPrefs.enabled", true);
pref("marionette.defaultPrefs.port", 2828);

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

@ -365,6 +365,54 @@ var shell = {
};
})();
const DATA_CALL_SETTING_BOLKEYS = ["ril.data.enabled",
"ril.data.roaming.enabled"];
const DATA_CALL_SETTING_CHARKEYS = ["ril.data.apn",
"ril.data.user",
"ril.data.passwd"];
(function DataCallSettings() {
let sm = navigator.mozSettings;
let lock = sm.getLock();
DATA_CALL_SETTING_BOLKEYS.forEach(function(key) {
let request = lock.get(key);
request.onsuccess = function onSuccess() {
let value = request.result[key] || false;
Services.prefs.setBoolPref(key, value);
dump("DataCallSettings - " + key + ":" + value);
};
request.onerror = function onError() {
Services.prefs.setBoolPref(key, false);
};
});
DATA_CALL_SETTING_CHARKEYS.forEach(function(key) {
let request = lock.get(key);
request.onsuccess = function onSuccess() {
let value = request.result[key] || "";
Services.prefs.setCharPref(key, value);
dump("DataCallSettings - " + key + ":" + value);
};
request.onerror = function onError() {
Services.prefs.setCharPref(key, "");
};
});
navigator.mozSettings.onsettingchange = function onSettingChange(e) {
dump("DataCallSettings - onsettingchange: " + e.settingName +
": " + e.settingValue);
if (e.settingValue) {
if (DATA_CALL_SETTING_BOLKEYS.indexOf(e.settingName) > -1 ) {
Services.prefs.setBoolPref(e.settingName, e.settingValue);
return;
}
if (DATA_CALL_SETTING_CHARKEYS.indexOf(e.settingName) > -1) {
Services.prefs.setCharPref(e.settingName, e.settingValue);
}
}
};
})();
function nsBrowserAccess() {
}

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

@ -55,7 +55,7 @@
<Description>
<em:id>{3c2e2abc-06d4-11e1-ac3b-374f68613e61}</em:id>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_VERSION@</em:maxVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>
</Description>

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

@ -7,7 +7,7 @@ export MOZILLA_OFFICIAL=1
mk_add_options MOZ_MAKE_FLAGS=-j1
. $topsrcdir/browser/config/mozconfigs/win32/vs2010-mozconfig
. $topsrcdir/build/win32/mozconfig.vs2010
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

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

@ -3,4 +3,4 @@ ac_add_options --enable-update-packaging
ac_add_options --enable-official-branding
ac_add_options --with-l10n-base=../../l10n-central
. $topsrcdir/browser/config/mozconfigs/win32/vs2010-mozconfig
. $topsrcdir/build/win32/mozconfig.vs2010

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

@ -16,7 +16,7 @@ export MOZ_TELEMETRY_REPORTING=1
mk_add_options MOZ_MAKE_FLAGS=-j1
. $topsrcdir/browser/config/mozconfigs/win32/vs2010-mozconfig
. $topsrcdir/build/win32/mozconfig.vs2010
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

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

@ -12,7 +12,7 @@ export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
. $topsrcdir/browser/config/mozconfigs/win32/vs2010-mozconfig
. $topsrcdir/build/win32/mozconfig.vs2010
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

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

@ -13,4 +13,4 @@ mk_add_options MOZ_MAKE_FLAGS=-j1
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
. $topsrcdir/browser/config/mozconfigs/win64/vs2010-mozconfig
. $topsrcdir/build/win64/mozconfig.vs2010

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

@ -22,4 +22,4 @@ mk_add_options MOZ_MAKE_FLAGS=-j1
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
. $topsrcdir/browser/config/mozconfigs/win64/vs2010-mozconfig
. $topsrcdir/build/win64/mozconfig.vs2010

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

@ -48,7 +48,10 @@ include $(topsrcdir)/config/rules.mk
MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
# Some files have been already bundled with xulrunner
ifndef SYSTEM_LIBXUL
MOZ_PKG_FATAL_WARNINGS = 1
endif
MOZ_NONLOCALIZED_PKG_LIST = \
xpcom \

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

@ -55,7 +55,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_VERSION@</em:maxVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>
</Description>

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

@ -327,8 +327,12 @@ configure-preqs = \
configure-files \
$(call mkdir_deps,$(OBJDIR)) \
$(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
save-mozconfig \
$(NULL)
save-mozconfig:
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
configure:: $(configure-preqs)
@echo cd $(OBJDIR);
@echo $(CONFIGURE) $(CONFIGURE_ARGS)

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

@ -134,6 +134,11 @@ class Preprocessor:
rv.out = self.out
return rv
def applyFilters(self, aLine):
for f in self.filters:
aLine = f[1](aLine)
return aLine
def write(self, aLine):
"""
Internal method for handling output.
@ -146,8 +151,7 @@ class Preprocessor:
'file': self.context['FILE'],
'le': self.LE})
self.writtenLines = ln
for f in self.filters:
aLine = f[1](aLine)
aLine = self.applyFilters(aLine)
# ensure our line ending. Only need to handle \n, as we're reading
# with universal line ending support, at least for files.
aLine = re.sub('\n', self.LE, aLine)
@ -242,7 +246,7 @@ class Preprocessor:
raise Preprocessor.Error(self, 'SYNTAX_DEF', args)
val = 1
if m.group('value'):
val = m.group('value')
val = self.applyFilters(m.group('value'))
try:
val = int(val)
except:
@ -423,6 +427,7 @@ class Preprocessor:
if isName:
try:
args = str(args)
args = self.applyFilters(args)
if not os.path.isabs(args):
args = os.path.join(self.context['DIRECTORY'], args)
args = open(args, 'rU')

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

@ -59,6 +59,7 @@ MOZ_PROFILE_MIGRATOR = @MOZ_PROFILE_MIGRATOR@
MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_APP_MAXVERSION = @MOZ_APP_MAXVERSION@
MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@
MOZ_APP_STATIC_INI = @MOZ_APP_STATIC_INI@
@ -550,6 +551,7 @@ MOZ_ENABLE_DWRITE_FONT = @MOZ_ENABLE_DWRITE_FONT@
MOZ_ENABLE_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@
MOZ_ENABLE_D3D10_LAYER = @MOZ_ENABLE_D3D10_LAYER@
MOZ_METRO = @MOZ_METRO@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@

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

@ -660,12 +660,6 @@ endif
-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
-include $(MY_CONFIG)
######################################################################
# Now test variables that might have been set or overridden by $(MY_CONFIG).
DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
DEFINES += -DOSARCH=$(OS_ARCH)
######################################################################
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB

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

@ -404,6 +404,15 @@ FAIL
self.pp.do_include(f)
self.assertEqual(self.pp.out.getvalue(), "first\rsecond\r")
def test_filterDefine(self):
f = NamedIO('filterDefine.in', '''#filter substitution
#define VAR AS
#define VAR2 P@VAR@
@VAR2@S
''')
self.pp.do_include(f)
self.assertEqual(self.pp.out.getvalue(), "PASS\n")
def test_number_value_equals(self):
f = NamedIO("number_value_equals.in", """#define FOO 1000
#if FOO == 1000

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

@ -678,25 +678,49 @@ fi
dnl ========================================================
dnl Special win32 checks
dnl ========================================================
WINVER=502
dnl Target the Windows 7 SDK by default
WINSDK_TARGETVER=601
# With win8, sdk target=602, WINVER=602
MOZ_ARG_ENABLE_BOOL(metro,
[ --enable-metro Enable Windows Metro build targets],
MOZ_METRO=1,
MOZ_METRO=)
if test -n "$MOZ_METRO"; then
AC_DEFINE(MOZ_METRO)
# Target the Windows 8 Kit
WINSDK_TARGETVER=602
# Allow a higher api set
WINVER=602
else
# Target the Windows 7 SDK by default
WINSDK_TARGETVER=601
WINVER=502
fi
if test -n "$MOZ_METRO"; then
case "$target" in
*-mingw*)
;;
*)
AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
;;
esac
fi
MOZ_ARG_WITH_STRING(windows-version,
[ --with-windows-version=WINSDK_TARGETVER
Highest Windows version to target using this SDK
601: Windows 7],
Windows SDK version to target. Lowest version
currently allowed is 601 (Win7), highest is 602 (Win8)],
WINSDK_TARGETVER=$withval)
# Currently only two sdk versions allowed, 601 and 602
case "$WINSDK_TARGETVER" in
601)
601|602)
MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
;;
*)
AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
;;
esac
case "$target" in
@ -778,6 +802,16 @@ case "$target" in
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
fi
dnl Confirm we have the pri tools on win8 builds
if test -n "$MOZ_METRO"; then
AC_MSG_CHECKING([for makepri])
AC_CHECK_PROGS(MAKEPRI, makepri, "")
if test -z "MAKEPRI" ; then
AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
fi
AC_SUBST(MAKEPRI)
fi
dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
dnl not something else like "magnetic tape manipulation utility".
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
@ -966,7 +1000,7 @@ EOF
AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
fi
MOZ_WINSDK_MAXVER=0x06010000
MOZ_WINSDK_MAXVER=0x06020000
fi # !GNU_CC
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
@ -983,7 +1017,18 @@ EOF
AC_MSG_RESULT("no")
AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
# Make sure the sdk / code we're targeting has the right toolset
AC_MSG_CHECKING([SDK and tools are in sync])
if test -n "$MOZ_METRO"; then
if test "$MOZ_MSVCVERSION" -gt "10"; then
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
fi
fi
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
@ -7881,7 +7926,9 @@ fi # ! SKIP_COMPILER_CHECKS
AC_DEFINE(CPP_THROW_NEW, [throw()])
AC_LANG_C
if test "$COMPILE_ENVIRONMENT"; then
MOZ_EXPAND_LIBS
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl =
@ -8445,6 +8492,7 @@ AC_SUBST(MOZ_D3DX9_CAB)
AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_D3DX9_DLL)
AC_SUBST(MOZ_D3DCOMPILER_DLL)
AC_SUBST(MOZ_METRO)
AC_SUBST(MOZ_ANDROID_HISTORY)
AC_SUBST(MOZ_WEBSMS_BACKEND)
@ -8518,6 +8566,20 @@ if test -z "$MOZ_APP_NAME"; then
MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
fi
# For extensions and langpacks, we require a max version that is compatible
# across security releases. MOZ_APP_MAXVERSION is our method for doing that.
# 10.0a1 and 10.0a2 aren't affected
# 10.0 becomes 10.0.*
# 10.0.1 becomes 10.0.*
IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
if test -z "$IS_ALPHA"; then
changequote(,)
MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
changequote([,])
else
MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
fi
AC_SUBST(MOZ_APP_NAME)
AC_SUBST(MOZ_APP_DISPLAYNAME)
AC_SUBST(MOZ_APP_BASENAME)
@ -8532,6 +8594,7 @@ AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
AC_SUBST(MOZ_APP_UA_NAME)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_APP_MAXVERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION)

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

@ -444,6 +444,15 @@ public:
*/
static bool ParseIntMarginValue(const nsAString& aString, nsIntMargin& aResult);
/**
* Parse the value of the <font size=""> attribute according to the HTML5
* spec as of April 16, 2012.
*
* @param aValue the value to parse
* @return 1 to 7, or 0 if the value couldn't be parsed
*/
static PRInt32 ParseLegacyFontSize(const nsAString& aValue);
static void Shutdown();
/**

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

@ -243,6 +243,12 @@ interface nsIDocumentEncoder : nsISupports
*/
const unsigned long OutputDropInvisibleBreak = (1 << 21);
/**
* Don't check for _moz_dirty attributes when deciding whether to
* pretty-print if this flag is set (bug 599983).
*/
const unsigned long OutputIgnoreMozDirty = (1 << 22);
/**
* Initialize with a pointer to the document and the mime type.
* @param aDocument Document to encode.

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

@ -275,8 +275,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x772e7e52, 0xfadf, 0x4962, \
{ 0x8d, 0x96, 0x58, 0xfe, 0x75, 0x68, 0xaf, 0xa8 } }
{ 0xf73e3890, 0xe4ab, 0x453e, \
{ 0x8c, 0x78, 0x2d, 0x1f, 0xa4, 0x0b, 0x48, 0x00 } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -406,6 +406,8 @@ public:
*/
mozilla::dom::Element* AsElement();
virtual nsIDOMNode* AsDOMNode() = 0;
/**
* Return if this node has any children.
*/

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

@ -55,10 +55,10 @@ namespace mozilla {
namespace dom {
Link::Link(Element *aElement)
: mLinkState(defaultState)
, mRegistered(false)
, mElement(aElement)
: mElement(aElement)
, mHistory(services::GetHistoryService())
, mLinkState(defaultState)
, mRegistered(false)
{
NS_ABORT_IF_FALSE(mElement, "Must have an element");
}
@ -75,7 +75,7 @@ Link::GetLinkState() const
"Getting the link state of an unregistered Link!");
NS_ASSERTION(mLinkState != eLinkState_Unknown,
"Getting the link state with an unknown value!");
return mLinkState;
return nsLinkState(mLinkState);
}
void

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

@ -149,17 +149,17 @@ private:
already_AddRefed<nsIURI> GetURIToMutate();
void SetHrefAttribute(nsIURI *aURI);
nsLinkState mLinkState;
mutable nsCOMPtr<nsIURI> mCachedURI;
bool mRegistered;
Element * const mElement;
// Strong reference to History. The link has to unregister before History
// can disappear.
nsCOMPtr<IHistory> mHistory;
PRUint16 mLinkState;
bool mRegistered;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)

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

@ -362,12 +362,6 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
}
}
if (cleanupJS) {
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(sGeneration);
MarkMessageManagers();
xpc_UnmarkSkippableJSHolders();
}
#ifdef MOZ_XUL
nsXULPrototypeCache* xulCache = nsXULPrototypeCache::GetInstance();
if (xulCache) {
@ -375,6 +369,18 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
}
#endif
static bool previousWasJSCleanup = false;
if (cleanupJS) {
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(sGeneration);
MarkMessageManagers();
previousWasJSCleanup = true;
} else if (previousWasJSCleanup) {
previousWasJSCleanup = false;
if (!prepareForCC) {
xpc_UnmarkSkippableJSHolders();
}
}
return NS_OK;
}

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

@ -72,6 +72,8 @@ public:
bool aCloneText) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
virtual void DumpContent(FILE* out = stdout, PRInt32 aIndent = 0,

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

@ -141,7 +141,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIMEStateManager.h"
#include "nsContentErrors.h"
#include "nsUnicharUtilCIID.h"
#include "nsCompressedCharMap.h"
#include "nsINativeKeyBindings.h"
#include "nsIDOMNSEvent.h"
#include "nsXULPopupManager.h"
@ -1307,6 +1306,59 @@ nsContentUtils::ParseIntMarginValue(const nsAString& aString, nsIntMargin& resul
return true;
}
// static
PRInt32
nsContentUtils::ParseLegacyFontSize(const nsAString& aValue)
{
nsAString::const_iterator iter, end;
aValue.BeginReading(iter);
aValue.EndReading(end);
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
++iter;
}
if (iter == end) {
return 0;
}
bool relative = false;
bool negate = false;
if (*iter == PRUnichar('-')) {
relative = true;
negate = true;
++iter;
} else if (*iter == PRUnichar('+')) {
relative = true;
++iter;
}
if (*iter < PRUnichar('0') || *iter > PRUnichar('9')) {
return 0;
}
// We don't have to worry about overflow, since we can bail out as soon as
// we're bigger than 7.
PRInt32 value = 0;
while (iter != end && *iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
value = 10*value + (*iter - PRUnichar('0'));
if (value >= 7) {
break;
}
++iter;
}
if (relative) {
if (negate) {
value = 3 - value;
} else {
value = 3 + value;
}
}
return clamped(value, 1, 7);
}
/* static */
void
nsContentUtils::GetOfflineAppManifest(nsIDocument *aDocument, nsIURI **aURI)
@ -4590,7 +4642,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
}
PRUint32 len = nativeKeyEvent->alternativeCharCodes.Length();
if (!nativeKeyEvent->isShift) {
if (!nativeKeyEvent->IsShift()) {
for (PRUint32 i = 0; i < len; ++i) {
PRUint32 ch =
nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode;

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

@ -100,6 +100,8 @@ public:
nsIAttribute)
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual mozilla::dom::Element* GetNameSpaceElement()
{

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

@ -106,6 +106,8 @@ public:
bool aCloneText) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
nsString mPublicId;
nsString mSystemId;

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

@ -8545,8 +8545,7 @@ NS_IMETHODIMP
nsDocument::CreateTouchList(nsIVariant* aPoints,
nsIDOMTouchList** aRetVal)
{
nsRefPtr<nsDOMTouchList> retval =
new nsDOMTouchList(static_cast<nsIDocument*>(this));
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList();
if (aPoints) {
PRUint16 type;
aPoints->GetDataType(&type);

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

@ -999,6 +999,7 @@ public:
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
// DocSizeOfIncludingThis is inherited from nsIDocument.
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
friend class nsNodeUtils;

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

@ -103,6 +103,8 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual nsIAtom* DoGetID() const;
virtual nsIAtom *GetIDAttributeName() const;

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

@ -3944,10 +3944,7 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
event.pressure = pressure;
event.clickCount = clickCount;
event.inputSource = inputSource;
event.isShift = aSourceEvent->isShift;
event.isControl = aSourceEvent->isControl;
event.isAlt = aSourceEvent->isAlt;
event.isMeta = aSourceEvent->isMeta;
event.modifiers = aSourceEvent->modifiers;
event.flags |= aFlags; // Be careful not to overwrite existing flags!
return DispatchEvent(aPresContext, &event, aTarget, aFullDispatch, aStatus);
@ -5988,8 +5985,8 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_CLICK:
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
if (inputEvent->isControl || inputEvent->isMeta ||
inputEvent->isAlt ||inputEvent->isShift) {
if (inputEvent->IsControl() || inputEvent->IsMeta() ||
inputEvent->IsAlt() ||inputEvent->IsShift()) {
break;
}

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

@ -347,8 +347,8 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
--mDisableEntityEncoding;
}
bool forceFormat = content->HasAttr(kNameSpaceID_None,
nsGkAtoms::mozdirty);
bool forceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
content->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
DecrIndentation(name);

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

@ -823,6 +823,9 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
nsCOMPtr<nsIURI> uri;
chan->GetURI(getter_AddRefs(uri));
if (!uri) {
return NS_ERROR_FAILURE;
}
if (mContentType.EqualsASCII(APPLICATION_OCTET_STREAM)) {
nsCAutoString extType;
@ -954,7 +957,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
if (!pluginHost) {
return NS_ERROR_NOT_AVAILABLE;
}
pluginHost->CreateListenerForChannel(chan, this, getter_AddRefs(mFinalListener));
pluginHost->NewEmbeddedPluginStreamListener(uri, this, nsnull,
getter_AddRefs(mFinalListener));
break;
}
case eType_Loading:

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

@ -464,12 +464,13 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
break;
}
}
if (isJavaScript)
typeID = nsIProgrammingLanguage::JAVASCRIPT;
else {
// Use the object factory to locate a matching language.
nsCOMPtr<nsIScriptRuntime> runtime;
rv = NS_GetScriptRuntime(mimeType, getter_AddRefs(runtime));
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
if (NS_FAILED(rv) || runtime == nsnull) {
// Failed to get the explicitly specified language
NS_WARNING("Failed to find a scripting language");
@ -477,6 +478,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
} else
typeID = nsIProgrammingLanguage::JAVASCRIPT;
}
if (typeID != nsIProgrammingLanguage::UNKNOWN) {
// Get the version string, and ensure the language supports it.
nsAutoString versionName;
@ -487,7 +489,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
return false;
} else {
nsCOMPtr<nsIScriptRuntime> runtime;
rv = NS_GetScriptRuntimeByID(typeID, getter_AddRefs(runtime));
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
if (NS_FAILED(rv)) {
NS_ERROR("Failed to locate the language with this ID");
return false;

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

@ -75,6 +75,8 @@ public:
nsresult AppendTextForNormalize(const PRUnichar* aBuffer, PRUint32 aLength,
bool aNotify, nsIContent* aNextSibling);
virtual nsIDOMNode* AsDOMNode() { return this; }
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
virtual void DumpContent(FILE* out, PRInt32 aIndent, bool aDumpAll) const;

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

@ -565,8 +565,8 @@ nsXHTMLContentSerializer::CheckElementStart(nsIContent * aContent,
// The _moz_dirty attribute is emitted by the editor to
// indicate that this element should be pretty printed
// even if we're not in pretty printing mode
aForceFormat = aContent->HasAttr(kNameSpaceID_None,
nsGkAtoms::mozdirty);
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
nsIAtom *name = aContent->Tag();
PRInt32 namespaceID = aContent->GetNameSpaceID();
@ -592,8 +592,8 @@ nsXHTMLContentSerializer::CheckElementEnd(nsIContent * aContent,
{
NS_ASSERTION(!mIsHTMLSerializer, "nsHTMLContentSerializer shouldn't call this method !");
aForceFormat = aContent->HasAttr(kNameSpaceID_None,
nsGkAtoms::mozdirty);
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
nsIAtom *name = aContent->Tag();
PRInt32 namespaceID = aContent->GetNameSpaceID();

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

@ -955,13 +955,13 @@ nsCanvasRenderingContext2D::StyleColorToString(const nscolor& aColor, nsAString&
// We can't reuse the normal CSS color stringification code,
// because the spec calls for a different algorithm for canvas.
if (NS_GET_A(aColor) == 255) {
CopyUTF8toUTF16(nsPrintfCString(100, "#%02x%02x%02x",
CopyUTF8toUTF16(nsPrintfCString("#%02x%02x%02x",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),
aStr);
} else {
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, ",
CopyUTF8toUTF16(nsPrintfCString("rgba(%d, %d, %d, ",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),

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

@ -1146,13 +1146,13 @@ nsCanvasRenderingContext2DAzure::StyleColorToString(const nscolor& aColor, nsASt
// We can't reuse the normal CSS color stringification code,
// because the spec calls for a different algorithm for canvas.
if (NS_GET_A(aColor) == 255) {
CopyUTF8toUTF16(nsPrintfCString(100, "#%02x%02x%02x",
CopyUTF8toUTF16(nsPrintfCString("#%02x%02x%02x",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),
aStr);
} else {
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, ",
CopyUTF8toUTF16(nsPrintfCString("rgba(%d, %d, %d, ",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),

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

@ -357,8 +357,8 @@ static nsresult GenerateFlatTextContent(nsRange* aRange,
nsresult
nsContentEventHandler::ExpandToClusterBoundary(nsIContent* aContent,
bool aForward,
PRUint32* aXPOffset)
bool aForward,
PRUint32* aXPOffset)
{
// XXX This method assumes that the frame boundaries must be cluster
// boundaries. It's false, but no problem now, maybe.
@ -366,7 +366,7 @@ nsContentEventHandler::ExpandToClusterBoundary(nsIContent* aContent,
*aXPOffset == 0 || *aXPOffset == aContent->TextLength())
return NS_OK;
NS_ASSERTION(*aXPOffset >= 0 && *aXPOffset <= aContent->TextLength(),
NS_ASSERTION(*aXPOffset <= aContent->TextLength(),
"offset is out of range.");
nsRefPtr<nsFrameSelection> fs = mPresShell->FrameSelection();

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

@ -695,6 +695,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
mouseEvent->context = oldMouseEvent->context;
mouseEvent->relatedTarget = oldMouseEvent->relatedTarget;
mouseEvent->button = oldMouseEvent->button;
mouseEvent->buttons = oldMouseEvent->buttons;
mouseEvent->pressure = oldMouseEvent->pressure;
mouseEvent->inputSource = oldMouseEvent->inputSource;
newEvent = mouseEvent;
@ -712,6 +713,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
dragEvent->acceptActivation = oldDragEvent->acceptActivation;
dragEvent->relatedTarget = oldDragEvent->relatedTarget;
dragEvent->button = oldDragEvent->button;
dragEvent->buttons = oldDragEvent->buttons;
static_cast<nsMouseEvent*>(dragEvent)->inputSource =
static_cast<nsMouseEvent*>(oldDragEvent)->inputSource;
newEvent = dragEvent;
@ -753,6 +755,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
mouseScrollEvent->delta = oldMouseScrollEvent->delta;
mouseScrollEvent->relatedTarget = oldMouseScrollEvent->relatedTarget;
mouseScrollEvent->button = oldMouseScrollEvent->button;
mouseScrollEvent->buttons = oldMouseScrollEvent->buttons;
static_cast<nsMouseEvent_base*>(mouseScrollEvent)->inputSource =
static_cast<nsMouseEvent_base*>(oldMouseScrollEvent)->inputSource;
newEvent = mouseScrollEvent;
@ -890,10 +893,14 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
}
case NS_MOZTOUCH_EVENT:
{
newEvent = new nsMozTouchEvent(false, msg, nsnull,
static_cast<nsMozTouchEvent*>(mEvent)->streamId);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
nsMozTouchEvent* oldMozTouchEvent = static_cast<nsMozTouchEvent*>(mEvent);
nsMozTouchEvent* mozTouchEvent =
new nsMozTouchEvent(false, msg, nsnull,
static_cast<nsMozTouchEvent*>(mEvent)->streamId);
NS_ENSURE_TRUE(mozTouchEvent, NS_ERROR_OUT_OF_MEMORY);
isInputEvent = true;
mozTouchEvent->buttons = oldMozTouchEvent->buttons;
newEvent = mozTouchEvent;
break;
}
case NS_TOUCH_EVENT:
@ -916,10 +923,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
if (isInputEvent) {
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
nsInputEvent* newInputEvent = static_cast<nsInputEvent*>(newEvent);
newInputEvent->isShift = oldInputEvent->isShift;
newInputEvent->isControl = oldInputEvent->isControl;
newInputEvent->isAlt = oldInputEvent->isAlt;
newInputEvent->isMeta = oldInputEvent->isMeta;
newInputEvent->modifiers = oldInputEvent->modifiers;
}
newEvent->target = mEvent->target;

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

@ -78,7 +78,7 @@ NS_IMETHODIMP
nsDOMKeyboardEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isAlt;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsAlt();
return NS_OK;
}
@ -86,7 +86,7 @@ NS_IMETHODIMP
nsDOMKeyboardEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isControl;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsControl();
return NS_OK;
}
@ -94,7 +94,7 @@ NS_IMETHODIMP
nsDOMKeyboardEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isShift;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsShift();
return NS_OK;
}
@ -102,7 +102,17 @@ NS_IMETHODIMP
nsDOMKeyboardEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isMeta;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsMeta();
return NS_OK;
}
NS_IMETHODIMP
nsDOMKeyboardEvent::GetModifierState(const nsAString& aKey,
bool* aState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = GetModifierStateInternal(aKey);
return NS_OK;
}
@ -184,10 +194,7 @@ nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, bool aCanBubble, bool a
NS_ENSURE_SUCCESS(rv, rv);
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(mEvent);
keyEvent->isControl = aCtrlKey;
keyEvent->isAlt = aAltKey;
keyEvent->isShift = aShiftKey;
keyEvent->isMeta = aMetaKey;
keyEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
keyEvent->keyCode = aKeyCode;
keyEvent->charCode = aCharCode;

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

@ -43,6 +43,8 @@
#include "nsContentUtils.h"
#include "DictionaryHelpers.h"
using namespace mozilla;
nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
nsInputEvent* aEvent)
: nsDOMUIEvent(aPresContext, aEvent ? aEvent :
@ -123,10 +125,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
inputEvent->isControl = aCtrlKey;
inputEvent->isAlt = aAltKey;
inputEvent->isShift = aShiftKey;
inputEvent->isMeta = aMetaKey;
inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mClientPoint.x = aClientX;
mClientPoint.y = aClientY;
inputEvent->refPoint.x = aScreenX;
@ -145,6 +144,45 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
return NS_OK;
}
nsresult
nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
PRInt32 aDetail,
PRInt32 aScreenX,
PRInt32 aScreenY,
PRInt32 aClientX,
PRInt32 aClientY,
PRUint16 aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList)
{
Modifiers modifiers = ComputeModifierState(aModifiersList);
nsresult rv = InitMouseEvent(aType, aCanBubble, aCancelable, aView,
aDetail, aScreenX, aScreenY, aClientX, aClientY,
(modifiers & widget::MODIFIER_CONTROL) != 0,
(modifiers & widget::MODIFIER_ALT) != 0,
(modifiers & widget::MODIFIER_SHIFT) != 0,
(modifiers & widget::MODIFIER_META) != 0,
aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
switch(mEvent->eventStructType) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
case NS_MOZTOUCH_EVENT:
static_cast<nsInputEvent*>(mEvent)->modifiers = modifiers;
return NS_OK;
default:
MOZ_NOT_REACHED("There is no space to store the modifiers");
return NS_ERROR_FAILURE;
}
}
nsresult
nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
JSContext* aCx, jsval* aVal)
@ -152,11 +190,26 @@ nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
mozilla::dom::MouseEventInit d;
nsresult rv = d.Init(aCx, aVal);
NS_ENSURE_SUCCESS(rv, rv);
return InitMouseEvent(aType, d.bubbles, d.cancelable,
d.view, d.detail, d.screenX, d.screenY,
d.clientX, d.clientY,
d.ctrlKey, d.altKey, d.shiftKey, d.metaKey,
d.button, d.relatedTarget);
rv = InitMouseEvent(aType, d.bubbles, d.cancelable,
d.view, d.detail, d.screenX, d.screenY,
d.clientX, d.clientY,
d.ctrlKey, d.altKey, d.shiftKey, d.metaKey,
d.button, d.relatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
switch(mEvent->eventStructType) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
case NS_MOZTOUCH_EVENT:
static_cast<nsMouseEvent_base*>(mEvent)->buttons = d.buttons;
break;
default:
break;
}
return NS_OK;
}
NS_IMETHODIMP
@ -199,6 +252,27 @@ nsDOMMouseEvent::GetButton(PRUint16* aButton)
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButtons(PRUint16* aButtons)
{
NS_ENSURE_ARG_POINTER(aButtons);
switch(mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
case NS_MOZTOUCH_EVENT:
*aButtons = static_cast<nsMouseEvent_base*>(mEvent)->buttons;
break;
default:
MOZ_NOT_REACHED("Tried to get mouse buttons for non-mouse event!");
*aButtons = 0;
break;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
{
@ -296,7 +370,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isAlt;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsAlt();
return NS_OK;
}
@ -304,7 +378,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isControl;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsControl();
return NS_OK;
}
@ -312,7 +386,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isShift;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsShift();
return NS_OK;
}
@ -320,7 +394,17 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isMeta;
*aIsDown = static_cast<nsInputEvent*>(mEvent)->IsMeta();
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
bool* aState)
{
NS_ENSURE_ARG_POINTER(aState);
*aState = GetModifierStateInternal(aKey);
return NS_OK;
}

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

@ -65,6 +65,19 @@ public:
protected:
// Specific implementation for a mouse event.
virtual nsresult Which(PRUint32* aWhich);
nsresult InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
PRInt32 aDetail,
PRInt32 aScreenX,
PRInt32 aScreenY,
PRInt32 aClientX,
PRInt32 aClientY,
PRUint16 aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList);
};
#define NS_FORWARD_TO_NSDOMMOUSEEVENT \

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

@ -160,13 +160,16 @@ nsDOMTouch::Equals(nsIDOMTouch* aTouch)
}
// TouchList
nsDOMTouchList::nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
{
mPoints.AppendElements(aTouches);
}
DOMCI_DATA(TouchList, nsDOMTouchList)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMTouchList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TouchList)
@ -174,16 +177,10 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMTouchList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mPoints)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMTouchList)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMTouchList)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mPoints)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList)
@ -199,7 +196,7 @@ nsDOMTouchList::GetLength(PRUint32* aLength)
NS_IMETHODIMP
nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouch** aRetVal)
{
NS_IF_ADDREF(*aRetVal = nsDOMTouchList::GetItemAt(aIndex));
NS_IF_ADDREF(*aRetVal = mPoints.SafeElementAt(aIndex, nsnull));
return NS_OK;
}
@ -219,12 +216,6 @@ nsDOMTouchList::IdentifiedTouch(PRInt32 aIdentifier, nsIDOMTouch** aRetVal)
return NS_OK;
}
nsIDOMTouch*
nsDOMTouchList::GetItemAt(PRUint32 aIndex)
{
return mPoints.SafeElementAt(aIndex, nsnull);
}
// TouchEvent
nsDOMTouchEvent::nsDOMTouchEvent(nsPresContext* aPresContext,
@ -300,10 +291,8 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
aDetail);
NS_ENSURE_SUCCESS(rv, rv);
static_cast<nsInputEvent*>(mEvent)->isControl = aCtrlKey;
static_cast<nsInputEvent*>(mEvent)->isAlt = aAltKey;
static_cast<nsInputEvent*>(mEvent)->isShift = aShiftKey;
static_cast<nsInputEvent*>(mEvent)->isMeta = aMetaKey;
static_cast<nsInputEvent*>(mEvent)->InitBasicModifiers(aCtrlKey, aAltKey,
aShiftKey, aMetaKey);
mTouches = aTouches;
mTargetTouches = aTargetTouches;
mChangedTouches = aChangedTouches;
@ -331,11 +320,9 @@ nsDOMTouchEvent::GetTouches(nsIDOMTouchList** aTouches)
unchangedTouches.AppendElement(touches[i]);
}
}
t = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
unchangedTouches);
t = new nsDOMTouchList(unchangedTouches);
} else {
t = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
touchEvent->touches);
t = new nsDOMTouchList(touchEvent->touches);
}
mTouches = t;
return CallQueryInterface(mTouches, aTouches);
@ -365,8 +352,7 @@ nsDOMTouchEvent::GetTargetTouches(nsIDOMTouchList** aTargetTouches)
}
}
}
mTargetTouches = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
targetTouches);
mTargetTouches = new nsDOMTouchList(targetTouches);
return CallQueryInterface(mTargetTouches, aTargetTouches);
}
@ -388,36 +374,35 @@ nsDOMTouchEvent::GetChangedTouches(nsIDOMTouchList** aChangedTouches)
changedTouches.AppendElement(touches[i]);
}
}
mChangedTouches = new nsDOMTouchList(static_cast<nsIDOMTouchEvent*>(this),
changedTouches);
mChangedTouches = new nsDOMTouchList(changedTouches);
return CallQueryInterface(mChangedTouches, aChangedTouches);
}
NS_IMETHODIMP
nsDOMTouchEvent::GetAltKey(bool* aAltKey)
{
*aAltKey = static_cast<nsInputEvent*>(mEvent)->isAlt;
*aAltKey = static_cast<nsInputEvent*>(mEvent)->IsAlt();
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchEvent::GetMetaKey(bool* aMetaKey)
{
*aMetaKey = static_cast<nsInputEvent*>(mEvent)->isMeta;
*aMetaKey = static_cast<nsInputEvent*>(mEvent)->IsMeta();
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchEvent::GetCtrlKey(bool* aCtrlKey)
{
*aCtrlKey = static_cast<nsInputEvent*>(mEvent)->isControl;
*aCtrlKey = static_cast<nsInputEvent*>(mEvent)->IsControl();
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchEvent::GetShiftKey(bool* aShiftKey)
{
*aShiftKey = static_cast<nsInputEvent*>(mEvent)->isShift;
*aShiftKey = static_cast<nsInputEvent*>(mEvent)->IsShift();
return NS_OK;
}

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

@ -41,8 +41,6 @@
#include "nsIDOMTouchEvent.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsIDocument.h"
#include "dombindings.h"
class nsDOMTouch : public nsIDOMTouch
{
@ -129,46 +127,27 @@ protected:
float mForce;
};
class nsDOMTouchList MOZ_FINAL : public nsIDOMTouchList,
public nsWrapperCache
class nsDOMTouchList : public nsIDOMTouchList
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList)
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
NS_DECL_NSIDOMTOUCHLIST
nsDOMTouchList(nsISupports *aParent) : mParent(aParent)
{
SetIsDOMBinding();
}
nsDOMTouchList(nsISupports *aParent,
nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
: mPoints(aTouches),
mParent(aParent)
{
SetIsDOMBinding();
}
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
bool *triedToWrap)
{
return mozilla::dom::binding::TouchList::create(cx, scope, this,
triedToWrap);
}
nsISupports *GetParentObject()
{
return mParent;
}
nsDOMTouchList() { }
nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches);
void Append(nsIDOMTouch* aPoint)
{
mPoints.AppendElement(aPoint);
}
nsIDOMTouch* GetItemAt(PRUint32 aIndex)
{
return mPoints.SafeElementAt(aIndex, nsnull);
}
protected:
nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints;
nsCOMPtr<nsISupports> mParent;
};
class nsDOMTouchEvent : public nsDOMUIEvent,

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

@ -51,6 +51,10 @@
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "DictionaryHelpers.h"
#include "mozilla/Util.h"
#include "mozilla/Assertions.h"
using namespace mozilla;
nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
: nsDOMEvent(aPresContext, aEvent ?
@ -447,6 +451,106 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true;
}
// XXX Following struct and array are used only in
// nsDOMUIEvent::ComputeModifierState(), but if we define them in it,
// we fail to build on Mac at calling mozilla::ArrayLength().
struct nsModifierPair
{
mozilla::widget::Modifier modifier;
const char* name;
};
static const nsModifierPair kPairs[] = {
{ widget::MODIFIER_ALT, NS_DOM_KEYNAME_ALT },
{ widget::MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH },
{ widget::MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK },
{ widget::MODIFIER_CONTROL, NS_DOM_KEYNAME_CONTROL },
{ widget::MODIFIER_FN, NS_DOM_KEYNAME_FN },
{ widget::MODIFIER_META, NS_DOM_KEYNAME_META },
{ widget::MODIFIER_NUMLOCK, NS_DOM_KEYNAME_NUMLOCK },
{ widget::MODIFIER_SCROLL, NS_DOM_KEYNAME_SCROLL },
{ widget::MODIFIER_SHIFT, NS_DOM_KEYNAME_SHIFT },
{ widget::MODIFIER_SYMBOLLOCK, NS_DOM_KEYNAME_SYMBOLLOCK },
{ widget::MODIFIER_WIN, NS_DOM_KEYNAME_WIN }
};
/* static */
mozilla::widget::Modifiers
nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
{
if (aModifiersList.IsEmpty()) {
return 0;
}
// Be careful about the performance. If aModifiersList is too long,
// parsing it needs too long time.
// XXX Should we abort if aModifiersList is too long?
Modifiers modifiers = 0;
nsAString::const_iterator listStart, listEnd;
aModifiersList.BeginReading(listStart);
aModifiersList.EndReading(listEnd);
for (PRUint32 i = 0; i < mozilla::ArrayLength(kPairs); i++) {
nsAString::const_iterator start(listStart), end(listEnd);
if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {
continue;
}
if ((start != listStart && !NS_IsAsciiWhitespace(*(--start))) ||
(end != listEnd && !NS_IsAsciiWhitespace(*(end)))) {
continue;
}
modifiers |= kPairs[i].modifier;
}
return modifiers;
}
bool
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
{
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SHIFT)) {
return inputEvent->IsShift();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_CONTROL)) {
return inputEvent->IsControl();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_META)) {
return inputEvent->IsMeta();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_ALT)) {
return inputEvent->IsAlt();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_ALTGRAPH)) {
return inputEvent->IsAltGraph();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_WIN)) {
return inputEvent->IsWin();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_CAPSLOCK)) {
return inputEvent->IsCapsLocked();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_NUMLOCK)) {
return inputEvent->IsNumLocked();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_FN)) {
return inputEvent->IsFn();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SCROLL)) {
return inputEvent->IsScrollLocked();
}
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SYMBOLLOCK)) {
return inputEvent->IsSymbolLocked();
}
return false;
}
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsGUIEvent *aEvent)

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

@ -42,6 +42,7 @@
#include "nsIDOMUIEvent.h"
#include "nsDOMEvent.h"
#include "nsLayoutUtils.h"
#include "nsEvent.h"
class nsDOMUIEvent : public nsDOMEvent,
public nsIDOMUIEvent
@ -150,6 +151,10 @@ protected:
bool mIsPointerLocked;
nsIntPoint mLastScreenPoint;
nsIntPoint mLastClientPoint;
typedef mozilla::widget::Modifiers Modifiers;
static Modifiers ComputeModifierState(const nsAString& aModifiersList);
bool GetModifierStateInternal(const nsAString& aKey);
};
#define NS_FORWARD_TO_NSDOMUIEVENT \

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

@ -79,7 +79,7 @@ NS_IMETHODIMP
nsDOMXULCommandEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = Event()->isAlt;
*aIsDown = Event()->IsAlt();
return NS_OK;
}
@ -87,7 +87,7 @@ NS_IMETHODIMP
nsDOMXULCommandEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = Event()->isControl;
*aIsDown = Event()->IsControl();
return NS_OK;
}
@ -95,7 +95,7 @@ NS_IMETHODIMP
nsDOMXULCommandEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = Event()->isShift;
*aIsDown = Event()->IsShift();
return NS_OK;
}
@ -103,7 +103,7 @@ NS_IMETHODIMP
nsDOMXULCommandEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = Event()->isMeta;
*aIsDown = Event()->IsMeta();
return NS_OK;
}
@ -128,11 +128,7 @@ nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
nsInputEvent *event = Event();
event->isControl = aCtrlKey;
event->isAlt = aAltKey;
event->isShift = aShiftKey;
event->isMeta = aMetaKey;
Event()->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mSourceEvent = aSourceEvent;
return NS_OK;

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

@ -357,13 +357,13 @@ GetBasePrefKeyForMouseWheel(nsMouseScrollEvent* aEvent, nsACString& aPref)
if (aEvent->scrollFlags & nsMouseScrollEvent::kIsHorizontal) {
aPref.Append(horizscroll);
}
if (aEvent->isShift) {
if (aEvent->IsShift()) {
aPref.Append(withshift);
} else if (aEvent->isControl) {
} else if (aEvent->IsControl()) {
aPref.Append(withcontrol);
} else if (aEvent->isAlt) {
} else if (aEvent->IsAlt()) {
aPref.Append(withalt);
} else if (aEvent->isMeta) {
} else if (aEvent->IsMeta()) {
aPref.Append(withmetakey);
} else {
aPref.Append(withno);
@ -1198,13 +1198,13 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
PRInt32 modifierMask = 0;
if (keyEvent->isShift)
if (keyEvent->IsShift())
modifierMask |= NS_MODIFIER_SHIFT;
if (keyEvent->isControl)
if (keyEvent->IsControl())
modifierMask |= NS_MODIFIER_CONTROL;
if (keyEvent->isAlt)
if (keyEvent->IsAlt())
modifierMask |= NS_MODIFIER_ALT;
if (keyEvent->isMeta)
if (keyEvent->IsMeta())
modifierMask |= NS_MODIFIER_META;
// Prevent keyboard scrolling while an accesskey modifier is in use.
@ -2004,10 +2004,8 @@ nsEventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
getter_AddRefs(mGestureDownContent));
mGestureDownFrameOwner = inDownFrame->GetContent();
mGestureDownShift = inDownEvent->isShift;
mGestureDownControl = inDownEvent->isControl;
mGestureDownAlt = inDownEvent->isAlt;
mGestureDownMeta = inDownEvent->isMeta;
mGestureModifiers = inDownEvent->modifiers;
mGestureDownButtons = inDownEvent->buttons;
if (mClickHoldContextMenu) {
// fire off a timer to track click-hold
@ -2040,10 +2038,8 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
// different
nsIntPoint tmpPoint = aEvent->widget->WidgetToScreenOffset();
aEvent->refPoint = mGestureDownPoint - tmpPoint;
aEvent->isShift = mGestureDownShift;
aEvent->isControl = mGestureDownControl;
aEvent->isAlt = mGestureDownAlt;
aEvent->isMeta = mGestureDownMeta;
aEvent->modifiers = mGestureModifiers;
aEvent->buttons = mGestureDownButtons;
}
//
@ -2214,8 +2210,9 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
// occurred, and aSelectionTarget is the node to use when a selection is used
bool canDrag;
nsCOMPtr<nsIContent> dragDataNode;
bool wasAlt = (mGestureModifiers & widget::MODIFIER_ALT) != 0;
nsresult rv = nsContentAreaDragDrop::GetDragData(window, mGestureDownContent,
aSelectionTarget, mGestureDownAlt,
aSelectionTarget, wasAlt,
aDataTransfer, &canDrag, aSelection,
getter_AddRefs(dragDataNode));
if (NS_FAILED(rv) || !canDrag)
@ -2573,10 +2570,8 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.scrollFlags = aEvent->scrollFlags;
event.delta = aNumLines;
event.inputSource = static_cast<nsMouseEvent_base*>(aEvent)->inputSource;
@ -2608,10 +2603,8 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.scrollFlags = aEvent->scrollFlags;
event.inputSource = static_cast<nsMouseEvent_base*>(aEvent)->inputSource;
event.delta = aPresContext->AppUnitsToIntCSSPixels(aEvent->delta * lineHeight);
@ -3407,10 +3400,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.isShift = mouseEvent->isShift;
event.isControl = mouseEvent->isControl;
event.isAlt = mouseEvent->isAlt;
event.isMeta = mouseEvent->isMeta;
event.modifiers = mouseEvent->modifiers;
event.buttons = mouseEvent->buttons;
event.inputSource = mouseEvent->inputSource;
nsEventStatus status = nsEventStatus_eIgnore;
@ -3437,7 +3428,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
//This is to prevent keyboard scrolling while alt modifier in use.
if (!keyEvent->isAlt) {
if (!keyEvent->IsAlt()) {
switch(keyEvent->keyCode) {
case NS_VK_TAB:
case NS_VK_F6:
@ -3445,10 +3436,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && mDocument) {
// Shift focus forward or back depending on shift key
bool isDocMove = ((nsInputEvent*)aEvent)->isControl ||
bool isDocMove = ((nsInputEvent*)aEvent)->IsControl() ||
(keyEvent->keyCode == NS_VK_F6);
PRUint32 dir =
static_cast<nsInputEvent*>(aEvent)->isShift ?
static_cast<nsInputEvent*>(aEvent)->IsShift() ?
(isDocMove ? static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_BACKWARDDOC) :
static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_BACKWARD)) :
(isDocMove ? static_cast<PRUint32>(nsIFocusManager::MOVEFOCUS_FORWARDDOC) :
@ -3832,10 +3823,8 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget,
nsMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
event.buttons = ((nsMouseEvent*)aEvent)->buttons;
event.pluginEvent = ((nsMouseEvent*)aEvent)->pluginEvent;
event.relatedTarget = aRelatedContent;
event.inputSource = static_cast<nsMouseEvent*>(aEvent)->inputSource;
@ -4245,10 +4234,8 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
nsEventStatus status = nsEventStatus_eIgnore;
nsDragEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMsg, aEvent->widget);
event.refPoint = aEvent->refPoint;
event.isShift = ((nsMouseEvent*)aEvent)->isShift;
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
event.buttons = ((nsMouseEvent*)aEvent)->buttons;
event.relatedTarget = aRelatedTarget;
event.inputSource = static_cast<nsMouseEvent*>(aEvent)->inputSource;
@ -4407,10 +4394,8 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
nsMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.clickCount = aEvent->clickCount;
event.isShift = aEvent->isShift;
event.isControl = aEvent->isControl;
event.isAlt = aEvent->isAlt;
event.isMeta = aEvent->isMeta;
event.modifiers = aEvent->modifiers;
event.buttons = aEvent->buttons;
event.time = aEvent->time;
event.flags |= flags;
event.button = aEvent->button;
@ -4428,10 +4413,8 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
aEvent->widget, nsMouseEvent::eReal);
event2.refPoint = aEvent->refPoint;
event2.clickCount = aEvent->clickCount;
event2.isShift = aEvent->isShift;
event2.isControl = aEvent->isControl;
event2.isAlt = aEvent->isAlt;
event2.isMeta = aEvent->isMeta;
event2.modifiers = aEvent->modifiers;
event2.buttons = aEvent->buttons;
event2.flags |= flags;
event2.button = aEvent->button;
event2.inputSource = aEvent->inputSource;
@ -5030,10 +5013,8 @@ nsEventStateManager::DoQueryScrollTargetInfo(nsQueryContentEvent* aEvent,
aEvent->mInput.mMouseScrollEvent->message,
aEvent->mInput.mMouseScrollEvent->widget);
msEvent.isShift = aEvent->mInput.mMouseScrollEvent->isShift;
msEvent.isControl = aEvent->mInput.mMouseScrollEvent->isControl;
msEvent.isAlt = aEvent->mInput.mMouseScrollEvent->isAlt;
msEvent.isMeta = aEvent->mInput.mMouseScrollEvent->isMeta;
msEvent.modifiers = aEvent->mInput.mMouseScrollEvent->modifiers;
msEvent.buttons = aEvent->mInput.mMouseScrollEvent->buttons;
msEvent.scrollFlags = aEvent->mInput.mMouseScrollEvent->scrollFlags;
msEvent.delta = ComputeWheelDeltaFor(aEvent->mInput.mMouseScrollEvent);

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

@ -506,10 +506,8 @@ private:
// an <area> of an image map this is the image. (bug 289667)
nsCOMPtr<nsIContent> mGestureDownFrameOwner;
// State of keys when the original gesture-down happened
bool mGestureDownShift;
bool mGestureDownControl;
bool mGestureDownAlt;
bool mGestureDownMeta;
mozilla::widget::Modifiers mGestureModifiers;
PRUint16 mGestureDownButtons;
nsCOMPtr<nsIContent> mLastLeftMouseDownContent;
nsCOMPtr<nsIContent> mLastLeftMouseDownContentParent;

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

@ -115,6 +115,8 @@ _TEST_FILES = \
test_eventctors.html \
test_bug635465.html \
test_bug741666.html \
test_dom_keyboard_event.html \
test_dom_mouse_event.html \
$(NULL)
#bug 585630

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

@ -0,0 +1,151 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for DOM KeyboardEvent</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests, window);
function testInitializingUntrustedEvent()
{
const kTests = [
{ createEventArg: "KeyboardEvent",
type: "keydown", bubbles: true, cancelable: true, view: null,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
keyCode: 0x00, charCode: 0x00 },
{ createEventArg: "keyboardevent",
type: "keyup", bubbles: false, cancelable: true, view: window,
ctrlKey: true, altKey: false, shiftKey: false, metaKey: false,
keyCode: 0x10, charCode: 0x00 },
{ createEventArg: "Keyboardevent",
type: "keypess", bubbles: true, cancelable: false, view: null,
ctrlKey: false, altKey: true, shiftKey: false, metaKey: false,
keyCode: 0x11, charCode: 0x30 },
{ createEventArg: "keyboardEvent",
type: "boo", bubbles: false, cancelable: false, view: window,
ctrlKey: false, altKey: false, shiftKey: true, metaKey: false,
keyCode: 0x30, charCode: 0x40 },
{ createEventArg: "KeyEvents",
type: "foo", bubbles: true, cancelable: true, view: null,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: true,
keyCode: 0x00, charCode: 0x50 },
{ createEventArg: "keyevents",
type: "bar", bubbles: false, cancelable: true, view: window,
ctrlKey: true, altKey: true, shiftKey: false, metaKey: false,
keyCode: 0x00, charCode: 0x60 },
{ createEventArg: "Keyevents",
type: "keydown", bubbles: true, cancelable: false, view: null,
ctrlKey: false, altKey: true, shiftKey: false, metaKey: true,
keyCode: 0x30, charCode: 0x00 },
{ createEventArg: "keyEvents",
type: "keyup", bubbles: false, cancelable: false, view: window,
ctrlKey: true, altKey: false, shiftKey: true, metaKey: false,
keyCode: 0x10, charCode: 0x80 },
{ createEventArg: "KeyboardEvent",
type: "keypress", bubbles: false, cancelable: false, view: window,
ctrlKey: true, altKey: false, shiftKey: true, metaKey: true,
keyCode: 0x10, charCode: 0x80 },
{ createEventArg: "KeyboardEvent",
type: "foo", bubbles: false, cancelable: false, view: window,
ctrlKey: true, altKey: true, shiftKey: true, metaKey: true,
keyCode: 0x10, charCode: 0x80 },
];
const kOtherModifierName = [
"CapsLock", "NumLock", "Scroll", "SymbolLock", "Fn", "Win", "AltGraph"
];
const kInvalidModifierName = [
"shift", "control", "alt", "meta", "capslock", "numlock", "scroll",
"symbollock", "fn", "win", "altgraph", "Invalid", "Shift Control"
];
for (var i = 0; i < kTests.length; i++) {
var description = "testInitializingUntrustedEvent, Index: " + i + ", ";
const kTest = kTests[i];
var e = document.createEvent(kTest.createEventArg);
e.initKeyEvent(kTest.type, kTest.bubbles, kTest.cancelable, kTest.view,
kTest.ctrlKey, kTest.altKey, kTest.shiftKey, kTest.metaKey,
kTest.keyCode, kTest.charCode);
for (var attr in kTest) {
if (attr == "createEventArg") {
continue;
}
if (attr == "keyCode") {
// If this is keydown, keyup of keypress event, keycod must be correct.
if (kTest.type == "keydown" || kTest.type == "keyup" || kTest.type == "keypress") {
is(e[attr], kTest[attr], description + attr + " returns wrong value");
// Otherwise, should be always zero (why?)
} else {
is(e[attr], 0, description + attr + " returns non-zero for invalid event");
}
} else if (attr == "charCode") {
// If this is keydown or keyup event, charCode always 0.
if (kTest.type == "keydown" || kTest.type == "keyup") {
is(e[attr], 0, description + attr + " returns non-zero for keydown or keyup event");
// If this is keypress event, charCode must be correct.
} else if (kTest.type == "keypress") {
is(e[attr], kTest[attr], description + attr + " returns wrong value");
// Otherwise, we have a bug.
} else {
if (e[attr] != kTest[attr]) { // avoid random unexpected pass.
todo_is(e[attr], kTest[attr], description + attr + " returns wrong value");
}
}
} else {
is(e[attr], kTest[attr], description + attr + " returns wrong value");
}
}
is(e.isTrusted, false, description + "isTrusted returns wrong value");
// getModifierState() tests
is(e.getModifierState("Shift"), kTest.shiftKey,
description + "getModifierState(\"Shift\") returns wrong value");
is(e.getModifierState("Control"), kTest.ctrlKey,
description + "getModifierState(\"Control\") returns wrong value");
is(e.getModifierState("Alt"), kTest.altKey,
description + "getModifierState(\"Alt\") returns wrong value");
is(e.getModifierState("Meta"), kTest.metaKey,
description + "getModifierState(\"Meta\") returns wrong value");
for (var j = 0; j < kOtherModifierName.length; j++) {
ok(!e.getModifierState(kOtherModifierName[j]),
description + "getModifierState(\"" + kOtherModifierName[j] + "\") returns wrong value");
}
for (var k = 0; k < kInvalidModifierName.length; k++) {
ok(!e.getModifierState(kInvalidModifierName[k]),
description + "getModifierState(\"" + kInvalidModifierName[k] + "\") returns wrong value");
}
}
}
function runTests()
{
testInitializingUntrustedEvent();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,140 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for DOM MouseEvent</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests, window);
function testInitializingUntrustedEvent()
{
const kTests = [
{ createEventArg: "MouseEvent",
type: "mousedown", bubbles: true, cancelable: true, view: null, detail: 1,
screenX: 0, screenY: 0, clientX: 0, clientY: 0,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
button: 6, relatedTarget: null },
{ createEventArg: "mouseevent",
type: "mouseup", bubbles: false, cancelable: true, view: window, detail: 2,
screenX: 0, screenY: 0, clientX: 0, clientY: 400,
ctrlKey: true, altKey: false, shiftKey: false, metaKey: false,
button: 1, relatedTarget: document.getElementById("content") },
{ createEventArg: "Mouseevent",
type: "click", bubbles: true, cancelable: false, view: null, detail: -5,
screenX: 0, screenY: 0, clientX: 300, clientY: 0,
ctrlKey: false, altKey: true, shiftKey: false, metaKey: false,
button: 2, relatedTarget: document.getElementById("test") },
{ createEventArg: "mouseEvent",
type: "dblclick", bubbles: false, cancelable: false, view: window, detail: -1,
screenX: 0, screenY: 200, clientX: 0, clientY: 0,
ctrlKey: false, altKey: false, shiftKey: true, metaKey: false,
button: 12, relatedTarget: document.getElementById("content") },
{ createEventArg: "MouseEvents",
type: "mouseenter", bubbles: true, cancelable: true, view: null, detail: 111000,
screenX: 100, screenY: 0, clientX: 0, clientY: 0,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: true,
button: 2, relatedTarget: document.getElementById("test") },
{ createEventArg: "mouseevents",
type: "mouseleave", bubbles: false, cancelable: true, view: window, detail: 500,
screenX: 100, screenY: 500, clientX: 0, clientY: 0,
ctrlKey: true, altKey: true, shiftKey: false, metaKey: false,
button: 8, relatedTarget: document.getElementById("content") },
{ createEventArg: "Mouseevents",
type: "mouseover", bubbles: true, cancelable: false, view: null, detail: 3,
screenX: 0, screenY: 0, clientX: 200, clientY: 300,
ctrlKey: false, altKey: true, shiftKey: false, metaKey: true,
button: 7, relatedTarget: document.getElementById("test") },
{ createEventArg: "mouseEvents",
type: "mouseout", bubbles: false, cancelable: false, view: window, detail: 5,
screenX: -100, screenY: 300, clientX: 600, clientY: -500,
ctrlKey: true, altKey: false, shiftKey: true, metaKey: false,
button: 8, relatedTarget: document.getElementById("content") },
{ createEventArg: "MouseEvent",
type: "mousemove", bubbles: false, cancelable: false, view: window, detail: 30,
screenX: 500, screenY: -100, clientX: -8888, clientY: -5000,
ctrlKey: true, altKey: false, shiftKey: true, metaKey: true,
button: 8, relatedTarget: document.getElementById("test") },
{ createEventArg: "MouseEvent",
type: "foo", bubbles: false, cancelable: false, view: window, detail: 100,
screenX: 2000, screenY: 6000, clientX: 5000, clientY: 3000,
ctrlKey: true, altKey: true, shiftKey: true, metaKey: true,
button: 8, relatedTarget: document.getElementById("test") },
];
const kOtherModifierName = [
"CapsLock", "NumLock", "Scroll", "SymbolLock", "Fn", "Win", "AltGraph"
];
const kInvalidModifierName = [
"shift", "control", "alt", "meta", "capslock", "numlock", "scroll",
"symbollock", "fn", "win", "altgraph", "Invalid", "Shift Control"
];
for (var i = 0; i < kTests.length; i++) {
var description = "testInitializingUntrustedEvent, Index: " + i + ", ";
const kTest = kTests[i];
var e = document.createEvent(kTest.createEventArg);
e.initMouseEvent(kTest.type, kTest.bubbles, kTest.cancelable, kTest.view,
kTest.detail, kTest.screenX, kTest.screenY, kTest.clientX, kTest.clientY,
kTest.ctrlKey, kTest.altKey, kTest.shiftKey, kTest.metaKey,
kTest.button, kTest.relatedTarget);
for (var attr in kTest) {
if (attr == "createEventArg") {
continue;
}
is(e[attr], kTest[attr], description + attr + " returns wrong value");
}
is(e.isTrusted, false, description + "isTrusted returns wrong value");
is(e.buttons, 0, description + "buttons returns wrong value");
// getModifierState() tests
is(e.getModifierState("Shift"), kTest.shiftKey,
description + "getModifierState(\"Shift\") returns wrong value");
is(e.getModifierState("Control"), kTest.ctrlKey,
description + "getModifierState(\"Control\") returns wrong value");
is(e.getModifierState("Alt"), kTest.altKey,
description + "getModifierState(\"Alt\") returns wrong value");
is(e.getModifierState("Meta"), kTest.metaKey,
description + "getModifierState(\"Meta\") returns wrong value");
for (var j = 0; j < kOtherModifierName.length; j++) {
ok(!e.getModifierState(kOtherModifierName[j]),
description + "getModifierState(\"" + kOtherModifierName[j] + "\") returns wrong value");
}
for (var k = 0; k < kInvalidModifierName.length; k++) {
ok(!e.getModifierState(kInvalidModifierName[k]),
description + "getModifierState(\"" + kInvalidModifierName[k] + "\") returns wrong value");
}
}
}
function runTests()
{
testInitializingUntrustedEvent();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

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

@ -395,6 +395,7 @@ var mouseEventProps =
{ altKey: false },
{ metaKey: false },
{ button: 0 },
{ buttons: 0 },
{ relatedTarget: null }
];
@ -409,6 +410,7 @@ var testProps =
{ altKey: true },
{ metaKey: true },
{ button: 5 },
{ buttons: 6 },
{ relatedTarget: window }
];

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

@ -79,6 +79,8 @@ public:
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
#endif

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

@ -184,6 +184,8 @@ public:
void MarkContextClean();
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
nsIntSize GetWidthHeight();

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

@ -90,6 +90,8 @@ public:
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
#endif

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

@ -697,13 +697,24 @@ nsGenericHTMLElement::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
nsresult rv = docEncoder->NativeInit(doc, contentType,
nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in
// the source
nsIDocumentEncoder::OutputRaw);
PRUint32 flags = nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in
// the source
nsIDocumentEncoder::OutputRaw |
// Only check for mozdirty when necessary (bug 599983)
nsIDocumentEncoder::OutputIgnoreMozDirty;
if (IsEditable()) {
nsCOMPtr<nsIEditor> editor;
GetEditorInternal(getter_AddRefs(editor));
if (editor && editor->OutputsMozDirty()) {
flags &= ~nsIDocumentEncoder::OutputIgnoreMozDirty;
}
}
nsresult rv = docEncoder->NativeInit(doc, contentType, flags);
NS_ENSURE_SUCCESS(rv, rv);
if (aIncludeSelf) {

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

@ -137,6 +137,8 @@ public:
virtual nsEventStates IntrinsicState() const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual void OnDNSPrefetchDeferred();
virtual void OnDNSPrefetchRequested();

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

@ -125,6 +125,8 @@ public:
virtual nsEventStates IntrinsicState() const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};

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

@ -77,6 +77,7 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};

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

@ -132,6 +132,7 @@ public:
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
private:
nsresult GetColorHelper(nsIAtom* aAtom, nsAString& aColor);

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

@ -161,7 +161,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual void DoneCreatingElement();
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
PRUint8 mType;
bool mDisabledChanged;

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

@ -74,7 +74,7 @@ public:
nsGenericHTMLElement)
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
// <option>'s list inside the datalist element.

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

@ -77,6 +77,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};

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