Merge m-c to s-c.

This commit is contained in:
Richard Newman 2012-04-25 18:55:05 -07:00
commit 865f048d0f
540 changed files with 14111 additions and 38871 deletions

View File

@ -797,10 +797,25 @@ interface nsIAccessibleRole : nsISupports
*/ */
const unsigned long ROLE_CHECK_RICH_OPTION = 125; 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 * It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized. * nsRoleMap's are synchronized.
*/ */
const unsigned long ROLE_LAST_ENTRY = 126; const unsigned long ROLE_LAST_ENTRY = 129;
}; };

View File

@ -171,6 +171,9 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_SECTION, // roles::NOTE 123 ATK_ROLE_SECTION, // roles::NOTE 123
ATK_ROLE_PANEL, // roles::FIGURE 124 ATK_ROLE_PANEL, // roles::FIGURE 124
ATK_ROLE_CHECK_BOX, // roles::CHECK_RICH_OPTION 125 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 kROLE_ATK_LAST_ENTRY // roles::LAST_ENTRY
}; };

View File

@ -798,11 +798,26 @@ namespace roles {
*/ */
CHECK_RICH_OPTION = 125, 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 * It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized. * nsRoleMap's are synchronized.
*/ */
LAST_ENTRY = 126 LAST_ENTRY = 129
}; };
} // namespace role } // namespace role
typedef enum mozilla::a11y::roles::Role role; typedef enum mozilla::a11y::roles::Role role;

View File

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

View File

@ -131,6 +131,8 @@ public:
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell); CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell); CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell); CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
@ -423,7 +425,10 @@ static const char kRoleNames[][20] = {
"embedded object", //ROLE_EMBEDDED_OBJECT "embedded object", //ROLE_EMBEDDED_OBJECT
"note", //ROLE_NOTE "note", //ROLE_NOTE
"figure", //ROLE_FIGURE "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
}; };
/** /**

View File

@ -1137,16 +1137,6 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
return; 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 // We treat aria-expanded as a global ARIA state for historical reasons
if (aAttribute == nsGkAtoms::aria_expanded) { if (aAttribute == nsGkAtoms::aria_expanded) {
nsRefPtr<AccEvent> event = nsRefPtr<AccEvent> event =
@ -1155,6 +1145,13 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
return; 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)) { if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
// We don't care about these other ARIA attribute changes unless there is // We don't care about these other ARIA attribute changes unless there is
// an ARIA role set for the element // an ARIA role set for the element

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -79,6 +79,8 @@ ToNSString(id aValue)
NSAccessibilityNumberOfCharactersAttribute, // required NSAccessibilityNumberOfCharactersAttribute, // required
NSAccessibilityVisibleCharacterRangeAttribute, // required NSAccessibilityVisibleCharacterRangeAttribute, // required
NSAccessibilityInsertionPointLineNumberAttribute, NSAccessibilityInsertionPointLineNumberAttribute,
@"AXRequired",
@"AXInvalid",
nil nil
]; ];
[supportedAttributes addObjectsFromArray:[super accessibilityAttributeNames]]; [supportedAttributes addObjectsFromArray:[super accessibilityAttributeNames]];
@ -115,6 +117,12 @@ ToNSString(id aValue)
return [self text]; 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]) if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute])
return [self visibleCharacterRange]; return [self visibleCharacterRange];

View File

@ -168,5 +168,8 @@ static const NSString* AXRoles [] = {
NSAccessibilityGroupRole, // roles::NOTE 123 NSAccessibilityGroupRole, // roles::NOTE 123
NSAccessibilityGroupRole, // roles::FIGURE 124 NSAccessibilityGroupRole, // roles::FIGURE 124
NSAccessibilityCheckBoxRole, // roles::CHECK_RICH_OPTION 125 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)! @"ROLE_LAST_ENTRY" // roles::LAST_ENTRY Bogus role that will never be shown (just marks the end of this array)!
}; };

View File

@ -452,6 +452,15 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
// roles::CHECK_RICH_OPTION // roles::CHECK_RICH_OPTION
{ ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON }, { 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 // roles::LAST_ENTRY
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY } { ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
}; };

View File

@ -21,6 +21,32 @@ xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
return NS_OK; 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 nsresult
xpcAccessibleTable::GetSummary(nsAString& aSummary) xpcAccessibleTable::GetSummary(nsAString& aSummary)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
*/ */
var gQueue = null; var gQueue = null;
function hideNode(aID, bHide) function updateAttribute(aID, aAttr, aValue)
{ {
this.node = getNode(aID); this.node = getNode(aID);
this.accessible = getAccessible(this.node); this.accessible = getAccessible(this.node);
@ -30,34 +30,14 @@
new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible), 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; return aAttr + " for " + aID + " " + aValue;
}
}
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;
} }
} }
@ -69,9 +49,12 @@
{ {
gQueue = new eventQueue(); 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(); gQueue.invoke(); // Will call SimpleTest.finish();
} }
@ -95,6 +78,12 @@
Mozilla Bug 640707 Mozilla Bug 640707
</a> </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> <p id="display"></p>
<div id="content" style="display: none"></div> <div id="content" style="display: none"></div>
<pre id="test"> <pre id="test">
@ -103,6 +92,8 @@
<div id="hideable"><div>Hi</div><div>there</div></div> <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> </body>
</html> </html>

View File

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

View File

@ -16,6 +16,8 @@ const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST; const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION; const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
const ROLE_COLUMNHEADER = nsIAccessibleRole.ROLE_COLUMNHEADER; 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_DIALOG = nsIAccessibleRole.ROLE_DIALOG;
const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT; const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT;
const ROLE_EMBEDDED_OBJECT = nsIAccessibleRole.ROLE_EMBEDDED_OBJECT; 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_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT; const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE; const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
const ROLE_TERM = nsIAccessibleRole.ROLE_TERM;
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER; const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF; const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON; const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;

View File

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

View File

@ -110,6 +110,7 @@
testStates("autocomplete-list", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION); testStates("autocomplete-list", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-list2", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION); testStates("autocomplete-list2", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-tel", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION); testStates("autocomplete-tel", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
testStates("autocomplete-email", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
SimpleTest.finish(); SimpleTest.finish();
} }
@ -235,5 +236,12 @@
<input id="autocomplete-list2" list="cities" autocomplete="off"> <input id="autocomplete-list2" list="cities" autocomplete="off">
<input id="autocomplete-tel" type="tel"> <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> </body>
</html> </html>

View File

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

View File

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

View File

@ -90,6 +90,19 @@
testAccessibleTree("txc6", accTree); testAccessibleTree("txc6", accTree);
// input@type="email", value
accTree = {
role: ROLE_ENTRY,
children: [
{ // text child
role: ROLE_TEXT_LEAF,
children: []
}
]
};
testAccessibleTree("txc7", accTree);
SimpleTest.finish(); SimpleTest.finish();
} }
@ -132,5 +145,12 @@
<input id="txc5" type="password" value="hello"> <input id="txc5" type="password" value="hello">
<input id="txc6" type="tel" value="4167771234"> <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> </body>
</html> </html>

View File

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

View File

@ -475,15 +475,6 @@ pref("full-screen-api.enabled", true);
pref("media.volume.steps", 10); 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 //Enable/disable marionette server, set listening port
pref("marionette.defaultPrefs.enabled", true); pref("marionette.defaultPrefs.enabled", true);
pref("marionette.defaultPrefs.port", 2828); pref("marionette.defaultPrefs.port", 2828);

View File

@ -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() { function nsBrowserAccess() {
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,7 +48,10 @@ include $(topsrcdir)/config/rules.mk
MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.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 MOZ_PKG_FATAL_WARNINGS = 1
endif
MOZ_NONLOCALIZED_PKG_LIST = \ MOZ_NONLOCALIZED_PKG_LIST = \
xpcom \ xpcom \

View File

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

View File

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

View File

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

View File

@ -59,6 +59,7 @@ MOZ_PROFILE_MIGRATOR = @MOZ_PROFILE_MIGRATOR@
MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@ MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@ MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_APP_VERSION = @MOZ_APP_VERSION@ MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_APP_MAXVERSION = @MOZ_APP_MAXVERSION@
MOZ_UA_BUILDID = @MOZ_UA_BUILDID@ MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@ MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@
MOZ_APP_STATIC_INI = @MOZ_APP_STATIC_INI@ 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_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@ MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@
MOZ_ENABLE_D3D10_LAYER = @MOZ_ENABLE_D3D10_LAYER@ MOZ_ENABLE_D3D10_LAYER = @MOZ_ENABLE_D3D10_LAYER@
MOZ_METRO = @MOZ_METRO@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@ MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@ MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@

View File

@ -660,12 +660,6 @@ endif
-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
-include $(MY_CONFIG) -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 GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB

View File

@ -404,6 +404,15 @@ FAIL
self.pp.do_include(f) self.pp.do_include(f)
self.assertEqual(self.pp.out.getvalue(), "first\rsecond\r") 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): def test_number_value_equals(self):
f = NamedIO("number_value_equals.in", """#define FOO 1000 f = NamedIO("number_value_equals.in", """#define FOO 1000
#if FOO == 1000 #if FOO == 1000

View File

@ -678,25 +678,49 @@ fi
dnl ======================================================== dnl ========================================================
dnl Special win32 checks dnl Special win32 checks
dnl ======================================================== dnl ========================================================
WINVER=502
dnl Target the Windows 7 SDK by default # With win8, sdk target=602, WINVER=602
WINSDK_TARGETVER=601 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, MOZ_ARG_WITH_STRING(windows-version,
[ --with-windows-version=WINSDK_TARGETVER [ --with-windows-version=WINSDK_TARGETVER
Highest Windows version to target using this SDK Windows SDK version to target. Lowest version
601: Windows 7], currently allowed is 601 (Win7), highest is 602 (Win8)],
WINSDK_TARGETVER=$withval) WINSDK_TARGETVER=$withval)
# Currently only two sdk versions allowed, 601 and 602
case "$WINSDK_TARGETVER" in case "$WINSDK_TARGETVER" in
601) 601|602)
MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000 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 esac
case "$target" in case "$target" in
@ -778,6 +802,16 @@ case "$target" in
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd` WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
fi 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 Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
dnl not something else like "magnetic tape manipulation utility". dnl not something else like "magnetic tape manipulation utility".
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` 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.]) AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
fi fi
MOZ_WINSDK_MAXVER=0x06010000 MOZ_WINSDK_MAXVER=0x06020000
fi # !GNU_CC fi # !GNU_CC
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER) AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
@ -984,6 +1018,17 @@ EOF
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.]) 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 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) AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h # Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000) AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
@ -7881,7 +7926,9 @@ fi # ! SKIP_COMPILER_CHECKS
AC_DEFINE(CPP_THROW_NEW, [throw()]) AC_DEFINE(CPP_THROW_NEW, [throw()])
AC_LANG_C AC_LANG_C
if test "$COMPILE_ENVIRONMENT"; then
MOZ_EXPAND_LIBS MOZ_EXPAND_LIBS
fi # COMPILE_ENVIRONMENT
dnl ======================================================== dnl ========================================================
dnl = dnl =
@ -8445,6 +8492,7 @@ AC_SUBST(MOZ_D3DX9_CAB)
AC_SUBST(MOZ_D3DCOMPILER_CAB) AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_D3DX9_DLL) AC_SUBST(MOZ_D3DX9_DLL)
AC_SUBST(MOZ_D3DCOMPILER_DLL) AC_SUBST(MOZ_D3DCOMPILER_DLL)
AC_SUBST(MOZ_METRO)
AC_SUBST(MOZ_ANDROID_HISTORY) AC_SUBST(MOZ_ANDROID_HISTORY)
AC_SUBST(MOZ_WEBSMS_BACKEND) 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` MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
fi 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_NAME)
AC_SUBST(MOZ_APP_DISPLAYNAME) AC_SUBST(MOZ_APP_DISPLAYNAME)
AC_SUBST(MOZ_APP_BASENAME) 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_SUBST(MOZ_APP_UA_NAME)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION") AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(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(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION) AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION) AC_SUBST(FIREFOX_VERSION)

View File

@ -444,6 +444,15 @@ public:
*/ */
static bool ParseIntMarginValue(const nsAString& aString, nsIntMargin& aResult); 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(); static void Shutdown();
/** /**

View File

@ -243,6 +243,12 @@ interface nsIDocumentEncoder : nsISupports
*/ */
const unsigned long OutputDropInvisibleBreak = (1 << 21); 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. * Initialize with a pointer to the document and the mime type.
* @param aDocument Document to encode. * @param aDocument Document to encode.

View File

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

View File

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

View File

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

View File

@ -362,12 +362,6 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
} }
} }
if (cleanupJS) {
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(sGeneration);
MarkMessageManagers();
xpc_UnmarkSkippableJSHolders();
}
#ifdef MOZ_XUL #ifdef MOZ_XUL
nsXULPrototypeCache* xulCache = nsXULPrototypeCache::GetInstance(); nsXULPrototypeCache* xulCache = nsXULPrototypeCache::GetInstance();
if (xulCache) { if (xulCache) {
@ -375,6 +369,18 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
} }
#endif #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; return NS_OK;
} }

View File

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

View File

@ -141,7 +141,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIMEStateManager.h" #include "nsIMEStateManager.h"
#include "nsContentErrors.h" #include "nsContentErrors.h"
#include "nsUnicharUtilCIID.h" #include "nsUnicharUtilCIID.h"
#include "nsCompressedCharMap.h"
#include "nsINativeKeyBindings.h" #include "nsINativeKeyBindings.h"
#include "nsIDOMNSEvent.h" #include "nsIDOMNSEvent.h"
#include "nsXULPopupManager.h" #include "nsXULPopupManager.h"
@ -1307,6 +1306,59 @@ nsContentUtils::ParseIntMarginValue(const nsAString& aString, nsIntMargin& resul
return true; 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 */ /* static */
void void
nsContentUtils::GetOfflineAppManifest(nsIDocument *aDocument, nsIURI **aURI) nsContentUtils::GetOfflineAppManifest(nsIDocument *aDocument, nsIURI **aURI)
@ -4590,7 +4642,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
} }
PRUint32 len = nativeKeyEvent->alternativeCharCodes.Length(); PRUint32 len = nativeKeyEvent->alternativeCharCodes.Length();
if (!nativeKeyEvent->isShift) { if (!nativeKeyEvent->IsShift()) {
for (PRUint32 i = 0; i < len; ++i) { for (PRUint32 i = 0; i < len; ++i) {
PRUint32 ch = PRUint32 ch =
nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode; nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -366,7 +366,7 @@ nsContentEventHandler::ExpandToClusterBoundary(nsIContent* aContent,
*aXPOffset == 0 || *aXPOffset == aContent->TextLength()) *aXPOffset == 0 || *aXPOffset == aContent->TextLength())
return NS_OK; return NS_OK;
NS_ASSERTION(*aXPOffset >= 0 && *aXPOffset <= aContent->TextLength(), NS_ASSERTION(*aXPOffset <= aContent->TextLength(),
"offset is out of range."); "offset is out of range.");
nsRefPtr<nsFrameSelection> fs = mPresShell->FrameSelection(); nsRefPtr<nsFrameSelection> fs = mPresShell->FrameSelection();

View File

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

View File

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

View File

@ -43,6 +43,8 @@
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "DictionaryHelpers.h" #include "DictionaryHelpers.h"
using namespace mozilla;
nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext, nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
nsInputEvent* aEvent) nsInputEvent* aEvent)
: nsDOMUIEvent(aPresContext, aEvent ? 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)->relatedTarget = aRelatedTarget;
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton; static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent); nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
inputEvent->isControl = aCtrlKey; inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
inputEvent->isAlt = aAltKey;
inputEvent->isShift = aShiftKey;
inputEvent->isMeta = aMetaKey;
mClientPoint.x = aClientX; mClientPoint.x = aClientX;
mClientPoint.y = aClientY; mClientPoint.y = aClientY;
inputEvent->refPoint.x = aScreenX; inputEvent->refPoint.x = aScreenX;
@ -145,6 +144,45 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
return NS_OK; 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 nsresult
nsDOMMouseEvent::InitFromCtor(const nsAString& aType, nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
JSContext* aCx, jsval* aVal) JSContext* aCx, jsval* aVal)
@ -152,11 +190,26 @@ nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
mozilla::dom::MouseEventInit d; mozilla::dom::MouseEventInit d;
nsresult rv = d.Init(aCx, aVal); nsresult rv = d.Init(aCx, aVal);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return InitMouseEvent(aType, d.bubbles, d.cancelable, rv = InitMouseEvent(aType, d.bubbles, d.cancelable,
d.view, d.detail, d.screenX, d.screenY, d.view, d.detail, d.screenX, d.screenY,
d.clientX, d.clientY, d.clientX, d.clientY,
d.ctrlKey, d.altKey, d.shiftKey, d.metaKey, d.ctrlKey, d.altKey, d.shiftKey, d.metaKey,
d.button, d.relatedTarget); 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 NS_IMETHODIMP
@ -199,6 +252,27 @@ nsDOMMouseEvent::GetButton(PRUint16* aButton)
return NS_OK; 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 NS_IMETHODIMP
nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget) nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
{ {
@ -296,7 +370,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetAltKey(bool* aIsDown) nsDOMMouseEvent::GetAltKey(bool* aIsDown)
{ {
NS_ENSURE_ARG_POINTER(aIsDown); NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isAlt; *aIsDown = static_cast<nsInputEvent*>(mEvent)->IsAlt();
return NS_OK; return NS_OK;
} }
@ -304,7 +378,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetCtrlKey(bool* aIsDown) nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
{ {
NS_ENSURE_ARG_POINTER(aIsDown); NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isControl; *aIsDown = static_cast<nsInputEvent*>(mEvent)->IsControl();
return NS_OK; return NS_OK;
} }
@ -312,7 +386,7 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetShiftKey(bool* aIsDown) nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
{ {
NS_ENSURE_ARG_POINTER(aIsDown); NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ((nsInputEvent*)mEvent)->isShift; *aIsDown = static_cast<nsInputEvent*>(mEvent)->IsShift();
return NS_OK; return NS_OK;
} }
@ -320,7 +394,17 @@ NS_IMETHODIMP
nsDOMMouseEvent::GetMetaKey(bool* aIsDown) nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
{ {
NS_ENSURE_ARG_POINTER(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; return NS_OK;
} }

View File

@ -65,6 +65,19 @@ public:
protected: protected:
// Specific implementation for a mouse event. // Specific implementation for a mouse event.
virtual nsresult Which(PRUint32* aWhich); 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 \ #define NS_FORWARD_TO_NSDOMMOUSEEVENT \

View File

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

View File

@ -41,8 +41,6 @@
#include "nsIDOMTouchEvent.h" #include "nsIDOMTouchEvent.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIDocument.h"
#include "dombindings.h"
class nsDOMTouch : public nsIDOMTouch class nsDOMTouch : public nsIDOMTouch
{ {
@ -129,46 +127,27 @@ protected:
float mForce; float mForce;
}; };
class nsDOMTouchList MOZ_FINAL : public nsIDOMTouchList, class nsDOMTouchList : public nsIDOMTouchList
public nsWrapperCache
{ {
public: public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList) NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
NS_DECL_NSIDOMTOUCHLIST NS_DECL_NSIDOMTOUCHLIST
nsDOMTouchList(nsISupports *aParent) : mParent(aParent) nsDOMTouchList() { }
{ nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches);
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;
}
void Append(nsIDOMTouch* aPoint) void Append(nsIDOMTouch* aPoint)
{ {
mPoints.AppendElement(aPoint); mPoints.AppendElement(aPoint);
} }
nsIDOMTouch* GetItemAt(PRUint32 aIndex)
{
return mPoints.SafeElementAt(aIndex, nsnull);
}
protected: protected:
nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints; nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints;
nsCOMPtr<nsISupports> mParent;
}; };
class nsDOMTouchEvent : public nsDOMUIEvent, class nsDOMTouchEvent : public nsDOMUIEvent,

View File

@ -51,6 +51,10 @@
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "DictionaryHelpers.h" #include "DictionaryHelpers.h"
#include "mozilla/Util.h"
#include "mozilla/Assertions.h"
using namespace mozilla;
nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent) nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
: nsDOMEvent(aPresContext, aEvent ? : nsDOMEvent(aPresContext, aEvent ?
@ -447,6 +451,106 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true; 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, nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext, nsPresContext* aPresContext,
nsGUIEvent *aEvent) nsGUIEvent *aEvent)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

@ -697,13 +697,24 @@ nsGenericHTMLElement::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE); NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
nsresult rv = docEncoder->NativeInit(doc, contentType, PRUint32 flags = nsIDocumentEncoder::OutputEncodeBasicEntities |
nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines // Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak | nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in // Don't do linebreaking that's not present in
// the source // the source
nsIDocumentEncoder::OutputRaw); 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); NS_ENSURE_SUCCESS(rv, rv);
if (aIncludeSelf) { if (aIncludeSelf) {

View File

@ -138,6 +138,8 @@ public:
virtual nsXPCClassInfo* GetClassInfo(); virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual void OnDNSPrefetchDeferred(); virtual void OnDNSPrefetchDeferred();
virtual void OnDNSPrefetchRequested(); virtual void OnDNSPrefetchRequested();
virtual bool HasDeferredDNSPrefetchRequest(); virtual bool HasDeferredDNSPrefetchRequest();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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