Merge m-c to f-t

This commit is contained in:
Phil Ringnalda 2013-10-20 09:57:49 -07:00
commit 6dfba8c5f0
184 changed files with 1371 additions and 683 deletions

View File

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 895047 - Clobber needed for touching js/src/js-confdefs.h.in
Bug 924992 - WebIDL headers changes not correctly picked up by the build system somehow

View File

@ -882,23 +882,23 @@ refRelationSetCB(AtkObject *aAtkObj)
return relation_set;
// Keep in sync with AtkRelationType enum.
static const uint32_t relationTypes[] = {
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_MEMBER_OF,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_SUBWINDOW_OF,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_EMBEDDED_BY,
nsIAccessibleRelation::RELATION_POPUP_FOR,
nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
nsIAccessibleRelation::RELATION_NODE_PARENT_OF
static const RelationType relationTypes[] = {
RelationType::CONTROLLED_BY,
RelationType::CONTROLLER_FOR,
RelationType::LABEL_FOR,
RelationType::LABELLED_BY,
RelationType::MEMBER_OF,
RelationType::NODE_CHILD_OF,
RelationType::FLOWS_TO,
RelationType::FLOWS_FROM,
RelationType::SUBWINDOW_OF,
RelationType::EMBEDS,
RelationType::EMBEDDED_BY,
RelationType::POPUP_FOR,
RelationType::PARENT_WINDOW_OF,
RelationType::DESCRIBED_BY,
RelationType::DESCRIPTION_FOR,
RelationType::NODE_PARENT_OF
};
for (uint32_t i = 0; i < ArrayLength(relationTypes); i++) {

View File

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef RELATION_H_
#define RELATION_H_
#ifndef mozilla_a11y_relation_h_
#define mozilla_a11y_relation_h_
#include "AccIterator.h"

View File

@ -0,0 +1,119 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_relationtype_h_
#define mozilla_a11y_relationtype_h_
#include "mozilla/TypedEnum.h"
namespace mozilla {
namespace a11y {
MOZ_BEGIN_ENUM_CLASS(RelationType)
/**
* This object is labelled by a target object.
*/
LABELLED_BY = 0x00,
/**
* This object is label for a target object.
*/
LABEL_FOR = 0x01,
/**
* This object is described by the target object.
*/
DESCRIBED_BY = 0x02,
/**
* This object is describes the target object.
*/
DESCRIPTION_FOR = 0x3,
/**
* This object is a child of a target object.
*/
NODE_CHILD_OF = 0x4,
/**
* This object is a parent of a target object. A dual relation to
* NODE_CHILD_OF.
*/
NODE_PARENT_OF = 0x5,
/**
* Some attribute of this object is affected by a target object.
*/
CONTROLLED_BY = 0x06,
/**
* This object is interactive and controls some attribute of a target object.
*/
CONTROLLER_FOR = 0x07,
/**
* Content flows from this object to a target object, i.e. has content that
* flows logically to another object in a sequential way, e.g. text flow.
*/
FLOWS_TO = 0x08,
/**
* Content flows to this object from a target object, i.e. has content that
* flows logically from another object in a sequential way, e.g. text flow.
*/
FLOWS_FROM = 0x09,
/**
* This object is a member of a group of one or more objects. When there is
* more than one object in the group each member may have one and the same
* target, e.g. a grouping object. It is also possible that each member has
* multiple additional targets, e.g. one for every other member in the group.
*/
MEMBER_OF = 0x0a,
/**
* This object is a sub window of a target object.
*/
SUBWINDOW_OF = 0x0b,
/**
* This object embeds a target object. This relation can be used on the
* OBJID_CLIENT accessible for a top level window to show where the content
* areas are.
*/
EMBEDS = 0x0c,
/**
* This object is embedded by a target object.
*/
EMBEDDED_BY = 0x0d,
/**
* This object is a transient component related to the target object. When
* this object is activated the target object doesn't lose focus.
*/
POPUP_FOR = 0x0e,
/**
* This object is a parent window of the target object.
*/
PARENT_WINDOW_OF = 0x0f,
/**
* Part of a form/dialog with a related default button. It is used for
* MSAA/XPCOM, it isn't for IA2 or ATK.
*/
DEFAULT_BUTTON = 0x10,
LAST = DEFAULT_BUTTON
MOZ_END_ENUM_CLASS(RelationType)
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -19,6 +19,7 @@ EXPORTS.mozilla.a11y += [
'DocManager.h',
'FocusManager.h',
'Platform.h',
'RelationType.h',
'Role.h',
'SelectionManager.h',
'States.h',

View File

@ -1519,7 +1519,7 @@ Accessible::State()
state |= states::SELECTED;
} else {
// If focus is in a child of the tab panel surely the tab is selected!
Relation rel = RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
Relation rel = RelationByType(RelationType::LABEL_FOR);
Accessible* relTarget = nullptr;
while ((relTarget = rel.Next())) {
if (relTarget->Role() == roles::PROPERTYPAGE &&
@ -1814,7 +1814,7 @@ Accessible::ARIATransformRole(role aRole)
if (mParent && mParent->Role() == roles::COMBOBOX) {
return roles::COMBOBOX_LIST;
Relation rel = RelationByType(nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
Relation rel = RelationByType(RelationType::NODE_CHILD_OF);
Accessible* targetAcc = nullptr;
while ((targetAcc = rel.Next()))
if (targetAcc->Role() == roles::COMBOBOX)
@ -1984,21 +1984,23 @@ Accessible::GetAtomicRegion() const
// nsIAccessible getRelationByType()
NS_IMETHODIMP
Accessible::GetRelationByType(uint32_t aType,
nsIAccessibleRelation** aRelation)
Accessible::GetRelationByType(uint32_t aType, nsIAccessibleRelation** aRelation)
{
NS_ENSURE_ARG_POINTER(aRelation);
*aRelation = nullptr;
NS_ENSURE_ARG(aType <= static_cast<uint32_t>(RelationType::LAST));
if (IsDefunct())
return NS_ERROR_FAILURE;
Relation rel = RelationByType(aType);
Relation rel = RelationByType(static_cast<RelationType>(aType));
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
return *aRelation ? NS_OK : NS_ERROR_FAILURE;
}
Relation
Accessible::RelationByType(uint32_t aType)
Accessible::RelationByType(RelationType aType)
{
if (!HasOwnContent())
return Relation();
@ -2006,7 +2008,7 @@ Accessible::RelationByType(uint32_t aType)
// Relationships are defined on the same content node that the role would be
// defined on.
switch (aType) {
case nsIAccessibleRelation::RELATION_LABELLED_BY: {
case RelationType::LABELLED_BY: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_labelledby));
if (mContent->IsHTML()) {
@ -2018,7 +2020,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_LABEL_FOR: {
case RelationType::LABEL_FOR: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_labelledby));
if (mContent->Tag() == nsGkAtoms::label && mContent->IsXUL())
@ -2027,7 +2029,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_DESCRIBED_BY: {
case RelationType::DESCRIBED_BY: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_describedby));
if (mContent->IsXUL())
@ -2036,7 +2038,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR: {
case RelationType::DESCRIPTION_FOR: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_describedby));
@ -2051,7 +2053,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
case RelationType::NODE_CHILD_OF: {
Relation rel(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_owns));
@ -2082,7 +2084,7 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: {
case RelationType::NODE_PARENT_OF: {
Relation rel(new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_owns));
// ARIA tree or treegrid can do the hierarchy by @aria-level, ARIA trees
@ -2100,36 +2102,36 @@ Accessible::RelationByType(uint32_t aType)
return rel;
}
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
case RelationType::CONTROLLED_BY:
return Relation(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_controls));
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR: {
case RelationType::CONTROLLER_FOR: {
Relation rel(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_controls));
rel.AppendIter(new HTMLOutputIterator(Document(), mContent));
return rel;
}
case nsIAccessibleRelation::RELATION_FLOWS_TO:
case RelationType::FLOWS_TO:
return Relation(new IDRefsIterator(mDoc, mContent,
nsGkAtoms::aria_flowto));
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
case RelationType::FLOWS_FROM:
return Relation(new RelatedAccIterator(Document(), mContent,
nsGkAtoms::aria_flowto));
case nsIAccessibleRelation::RELATION_MEMBER_OF:
case RelationType::MEMBER_OF:
return Relation(mDoc, GetAtomicRegion());
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
case nsIAccessibleRelation::RELATION_EMBEDS:
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
case nsIAccessibleRelation::RELATION_POPUP_FOR:
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
case RelationType::SUBWINDOW_OF:
case RelationType::EMBEDS:
case RelationType::EMBEDDED_BY:
case RelationType::POPUP_FOR:
case RelationType::PARENT_WINDOW_OF:
return Relation();
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON: {
case RelationType::DEFAULT_BUTTON: {
if (mContent->IsHTML()) {
// HTML form controls implements nsIFormControl interface.
nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));

View File

@ -7,6 +7,7 @@
#define _Accessible_H_
#include "mozilla/a11y/AccTypes.h"
#include "mozilla/a11y/RelationType.h"
#include "mozilla/a11y/Role.h"
#include "mozilla/a11y/States.h"
#include "nsAccessNode.h"
@ -294,7 +295,7 @@ public:
/**
* Get the relation of the given type.
*/
virtual mozilla::a11y::Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType);
//////////////////////////////////////////////////////////////////////////////
// Initializing methods

View File

@ -141,7 +141,7 @@ ApplicationAccessible::FocusedChild()
}
Relation
ApplicationAccessible::RelationByType(uint32_t aRelationType)
ApplicationAccessible::RelationByType(RelationType aRelationType)
{
return Relation();
}

View File

@ -70,7 +70,7 @@ public:
virtual mozilla::a11y::role NativeRole();
virtual uint64_t State();
virtual uint64_t NativeState();
virtual Relation RelationByType(uint32_t aRelType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild);

View File

@ -481,9 +481,9 @@ RootAccessible::Shutdown()
// nsIAccessible method
Relation
RootAccessible::RelationByType(uint32_t aType)
RootAccessible::RelationByType(RelationType aType)
{
if (!mDocumentNode || aType != nsIAccessibleRelation::RELATION_EMBEDS)
if (!mDocumentNode || aType != RelationType::EMBEDS)
return DocAccessibleWrap::RelationByType(aType);
nsIDOMWindow* rootWindow = mDocumentNode->GetWindow();

View File

@ -34,7 +34,7 @@ public:
// Accessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
virtual mozilla::a11y::role NativeRole();
virtual uint64_t NativeState();

View File

@ -65,10 +65,10 @@ HTMLLabelAccessible::NativeName(nsString& aName)
}
Relation
HTMLLabelAccessible::RelationByType(uint32_t aType)
HTMLLabelAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
if (aType == RelationType::LABEL_FOR) {
nsRefPtr<dom::HTMLLabelElement> label = dom::HTMLLabelElement::FromContent(mContent);
rel.AppendTarget(mDoc, label->GetControl());
}
@ -89,10 +89,10 @@ HTMLLabelAccessible::NativeRole()
NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible)
Relation
HTMLOutputAccessible::RelationByType(uint32_t aType)
HTMLOutputAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
if (aType == RelationType::CONTROLLED_BY)
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
return rel;

View File

@ -61,7 +61,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType) MOZ_OVERRIDE;
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
@ -82,7 +82,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
};
} // namespace a11y

View File

@ -659,11 +659,11 @@ HTMLGroupboxAccessible::NativeName(nsString& aName)
}
Relation
HTMLGroupboxAccessible::RelationByType(uint32_t aType)
HTMLGroupboxAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
// No override for label, so use <legend> for this <fieldset>
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
if (aType == RelationType::LABELLED_BY)
rel.AppendTarget(mDoc, GetLegend());
return rel;
@ -680,10 +680,10 @@ HTMLLegendAccessible::
}
Relation
HTMLLegendAccessible::RelationByType(uint32_t aType)
HTMLLegendAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
if (aType != RelationType::LABEL_FOR)
return rel;
Accessible* groupbox = Parent();
@ -742,10 +742,10 @@ HTMLFigureAccessible::NativeName(nsString& aName)
}
Relation
HTMLFigureAccessible::RelationByType(uint32_t aType)
HTMLFigureAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
if (aType == RelationType::LABELLED_BY)
rel.AppendTarget(mDoc, Caption());
return rel;
@ -782,10 +782,10 @@ HTMLFigcaptionAccessible::NativeRole()
}
Relation
HTMLFigcaptionAccessible::RelationByType(uint32_t aType)
HTMLFigcaptionAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
if (aType != RelationType::LABEL_FOR)
return rel;
Accessible* figure = Parent();

View File

@ -193,7 +193,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
// Accessible
@ -214,7 +214,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
};
/**
@ -228,7 +228,7 @@ public:
// Accessible
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
// Accessible
@ -249,7 +249,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
};
} // namespace a11y

View File

@ -451,10 +451,10 @@ HTMLTableAccessible::NativeAttributes()
// HTMLTableAccessible: nsIAccessible implementation
Relation
HTMLTableAccessible::RelationByType(uint32_t aType)
HTMLTableAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
if (aType == RelationType::LABELLED_BY)
rel.AppendTarget(Caption());
return rel;
@ -1118,10 +1118,10 @@ HTMLTableAccessible::IsProbablyLayoutTable()
////////////////////////////////////////////////////////////////////////////////
Relation
HTMLCaptionAccessible::RelationByType(uint32_t aType)
HTMLCaptionAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessible::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR)
if (aType == RelationType::LABEL_FOR)
rel.AppendTarget(Parent());
return rel;

View File

@ -172,7 +172,7 @@ public:
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual Relation RelationByType(uint32_t aRelationType);
virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE;
protected:
// Accessible
@ -231,7 +231,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aRelationType);
virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE;
};
} // namespace a11y

View File

@ -193,7 +193,7 @@ GetClosestInterestingAccessible(id anObject)
if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
return [self title];
if ([attribute isEqualToString:NSAccessibilityTitleUIElementAttribute]) {
Relation rel = mGeckoAccessible->RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY);
Relation rel = mGeckoAccessible->RelationByType(RelationType::LABELLED_BY);
Accessible* tempAcc = rel.Next();
return tempAcc ? GetNativeFromGeckoAccessible(tempAcc) : nil;
}

View File

@ -86,10 +86,10 @@ ia2Accessible::get_relation(long aRelationIndex,
long relIdx = 0;
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) {
uint32_t relType = sRelationTypesForIA2[idx];
Relation rel = acc->RelationByType(relType);
RelationType relationType = sRelationTypesForIA2[idx];
Relation rel = acc->RelationByType(relationType);
nsRefPtr<ia2AccessibleRelation> ia2Relation =
new ia2AccessibleRelation(relType, &rel);
new ia2AccessibleRelation(relationType, &rel);
if (ia2Relation->HasTargets()) {
if (relIdx == aRelationIndex) {
ia2Relation.forget(aRelation);
@ -122,10 +122,10 @@ ia2Accessible::get_relations(long aMaxRelations,
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2) &&
*aNRelations < aMaxRelations; idx++) {
uint32_t relType = sRelationTypesForIA2[idx];
Relation rel = acc->RelationByType(relType);
RelationType relationType = sRelationTypesForIA2[idx];
Relation rel = acc->RelationByType(relationType);
nsRefPtr<ia2AccessibleRelation> ia2Rel =
new ia2AccessibleRelation(relType, &rel);
new ia2AccessibleRelation(relationType, &rel);
if (ia2Rel->HasTargets()) {
ia2Rel.forget(aRelation + (*aNRelations));
(*aNRelations)++;

View File

@ -8,7 +8,6 @@
#include "ia2AccessibleRelation.h"
#include "Relation.h"
#include "IUnknownImpl.h"
#include "nsIAccessibleRelation.h"
#include "nsID.h"
@ -16,8 +15,8 @@
using namespace mozilla::a11y;
ia2AccessibleRelation::ia2AccessibleRelation(uint32_t aType, Relation* aRel) :
mType(aType), mReferences(0)
ia2AccessibleRelation::ia2AccessibleRelation(RelationType aType, Relation* aRel) :
mType(aType)
{
Accessible* target = nullptr;
while ((target = aRel->Next()))
@ -26,39 +25,10 @@ ia2AccessibleRelation::ia2AccessibleRelation(uint32_t aType, Relation* aRel) :
// IUnknown
STDMETHODIMP
ia2AccessibleRelation::QueryInterface(REFIID iid, void** ppv)
{
if (!ppv)
return E_INVALIDARG;
*ppv = nullptr;
if (IID_IAccessibleRelation == iid || IID_IUnknown == iid) {
*ppv = static_cast<IAccessibleRelation*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE
ia2AccessibleRelation::AddRef()
{
return mReferences++;
}
ULONG STDMETHODCALLTYPE
ia2AccessibleRelation::Release()
{
mReferences--;
ULONG references = mReferences;
if (!mReferences)
delete this;
return references;
}
IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleRelation)
IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleRelation)
IMPL_IUNKNOWN_QUERY_IFACE(IUnknown)
IMPL_IUNKNOWN_QUERY_TAIL
// IAccessibleRelation
@ -73,56 +43,54 @@ ia2AccessibleRelation::get_relationType(BSTR *aRelationType)
*aRelationType = nullptr;
switch (mType) {
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
case RelationType::CONTROLLED_BY:
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLED_BY);
break;
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
case RelationType::CONTROLLER_FOR:
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLER_FOR);
break;
case nsIAccessibleRelation::RELATION_DESCRIBED_BY:
case RelationType::DESCRIBED_BY:
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIBED_BY);
break;
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR:
case RelationType::DESCRIPTION_FOR:
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIPTION_FOR);
break;
case nsIAccessibleRelation::RELATION_EMBEDDED_BY:
case RelationType::EMBEDDED_BY:
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDDED_BY);
break;
case nsIAccessibleRelation::RELATION_EMBEDS:
case RelationType::EMBEDS:
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDS);
break;
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
case RelationType::FLOWS_FROM:
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_FROM);
break;
case nsIAccessibleRelation::RELATION_FLOWS_TO:
case RelationType::FLOWS_TO:
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_TO);
break;
case nsIAccessibleRelation::RELATION_LABEL_FOR:
case RelationType::LABEL_FOR:
*aRelationType = ::SysAllocString(IA2_RELATION_LABEL_FOR);
break;
case nsIAccessibleRelation::RELATION_LABELLED_BY:
case RelationType::LABELLED_BY:
*aRelationType = ::SysAllocString(IA2_RELATION_LABELED_BY);
break;
case nsIAccessibleRelation::RELATION_MEMBER_OF:
case RelationType::MEMBER_OF:
*aRelationType = ::SysAllocString(IA2_RELATION_MEMBER_OF);
break;
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF:
case RelationType::NODE_CHILD_OF:
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_CHILD_OF);
break;
case nsIAccessibleRelation::RELATION_NODE_PARENT_OF:
case RelationType::NODE_PARENT_OF:
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_PARENT_OF);
break;
case nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF:
case RelationType::PARENT_WINDOW_OF:
*aRelationType = ::SysAllocString(IA2_RELATION_PARENT_WINDOW_OF);
break;
case nsIAccessibleRelation::RELATION_POPUP_FOR:
case RelationType::POPUP_FOR:
*aRelationType = ::SysAllocString(IA2_RELATION_POPUP_FOR);
break;
case nsIAccessibleRelation::RELATION_SUBWINDOW_OF:
case RelationType::SUBWINDOW_OF:
*aRelationType = ::SysAllocString(IA2_RELATION_SUBWINDOW_OF);
break;
default:
return E_FAIL;
}
return *aRelationType ? S_OK : E_OUTOFMEMORY;

View File

@ -9,6 +9,7 @@
#define _NS_ACCESSIBLE_RELATION_WRAP_H
#include "Accessible.h"
#include "IUnknownImpl.h"
#include "nsIAccessibleRelation.h"
#include "nsTArray.h"
@ -18,16 +19,13 @@
namespace mozilla {
namespace a11y {
class ia2AccessibleRelation : public IAccessibleRelation
class ia2AccessibleRelation MOZ_FINAL : public IAccessibleRelation
{
public:
ia2AccessibleRelation(uint32_t aType, Relation* aRel);
virtual ~ia2AccessibleRelation() { }
ia2AccessibleRelation(RelationType aType, Relation* aRel);
// IUnknown
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID aIID, void** aOutPtr);
virtual ULONG STDMETHODCALLTYPE AddRef();
virtual ULONG STDMETHODCALLTYPE Release();
DECL_IUNKNOWN
// IAccessibleRelation
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType(
@ -56,32 +54,31 @@ private:
ia2AccessibleRelation(const ia2AccessibleRelation&);
ia2AccessibleRelation& operator = (const ia2AccessibleRelation&);
uint32_t mType;
RelationType mType;
nsTArray<nsRefPtr<Accessible> > mTargets;
ULONG mReferences;
};
/**
* Relations exposed to IAccessible2.
*/
static const uint32_t sRelationTypesForIA2[] = {
nsIAccessibleRelation::RELATION_LABELLED_BY,
nsIAccessibleRelation::RELATION_LABEL_FOR,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
nsIAccessibleRelation::RELATION_NODE_PARENT_OF,
nsIAccessibleRelation::RELATION_CONTROLLED_BY,
nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_MEMBER_OF,
nsIAccessibleRelation::RELATION_SUBWINDOW_OF,
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_EMBEDDED_BY,
nsIAccessibleRelation::RELATION_POPUP_FOR,
nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF
static const RelationType sRelationTypesForIA2[] = {
RelationType::LABELLED_BY,
RelationType::LABEL_FOR,
RelationType::DESCRIBED_BY,
RelationType::DESCRIPTION_FOR,
RelationType::NODE_CHILD_OF,
RelationType::NODE_PARENT_OF,
RelationType::CONTROLLED_BY,
RelationType::CONTROLLER_FOR,
RelationType::FLOWS_TO,
RelationType::FLOWS_FROM,
RelationType::MEMBER_OF,
RelationType::SUBWINDOW_OF,
RelationType::EMBEDS,
RelationType::EMBEDDED_BY,
RelationType::POPUP_FOR,
RelationType::PARENT_WINDOW_OF
};
} // namespace a11y

View File

@ -921,55 +921,55 @@ AccessibleWrap::accNavigate(
// MSAA relationship extensions to accNavigate
case NAVRELATION_CONTROLLED_BY:
xpRelation = nsIAccessibleRelation::RELATION_CONTROLLED_BY;
xpRelation = static_cast<int32_t>(RelationType::CONTROLLED_BY);
break;
case NAVRELATION_CONTROLLER_FOR:
xpRelation = nsIAccessibleRelation::RELATION_CONTROLLER_FOR;
xpRelation = static_cast<int32_t>(RelationType::CONTROLLER_FOR);
break;
case NAVRELATION_LABEL_FOR:
xpRelation = nsIAccessibleRelation::RELATION_LABEL_FOR;
xpRelation = static_cast<int32_t>(RelationType::LABEL_FOR);
break;
case NAVRELATION_LABELLED_BY:
xpRelation = nsIAccessibleRelation::RELATION_LABELLED_BY;
xpRelation = static_cast<int32_t>(RelationType::LABELLED_BY);
break;
case NAVRELATION_MEMBER_OF:
xpRelation = nsIAccessibleRelation::RELATION_MEMBER_OF;
xpRelation = static_cast<int32_t>(RelationType::MEMBER_OF);
break;
case NAVRELATION_NODE_CHILD_OF:
xpRelation = nsIAccessibleRelation::RELATION_NODE_CHILD_OF;
xpRelation = static_cast<int32_t>(RelationType::NODE_CHILD_OF);
break;
case NAVRELATION_FLOWS_TO:
xpRelation = nsIAccessibleRelation::RELATION_FLOWS_TO;
xpRelation = static_cast<int32_t>(RelationType::FLOWS_TO);
break;
case NAVRELATION_FLOWS_FROM:
xpRelation = nsIAccessibleRelation::RELATION_FLOWS_FROM;
xpRelation = static_cast<int32_t>(RelationType::FLOWS_FROM);
break;
case NAVRELATION_SUBWINDOW_OF:
xpRelation = nsIAccessibleRelation::RELATION_SUBWINDOW_OF;
xpRelation = static_cast<int32_t>(RelationType::SUBWINDOW_OF);
break;
case NAVRELATION_EMBEDS:
xpRelation = nsIAccessibleRelation::RELATION_EMBEDS;
xpRelation = static_cast<int32_t>(RelationType::EMBEDS);
break;
case NAVRELATION_EMBEDDED_BY:
xpRelation = nsIAccessibleRelation::RELATION_EMBEDDED_BY;
xpRelation = static_cast<int32_t>(RelationType::EMBEDDED_BY);
break;
case NAVRELATION_POPUP_FOR:
xpRelation = nsIAccessibleRelation::RELATION_POPUP_FOR;
xpRelation = static_cast<int32_t>(RelationType::POPUP_FOR);
break;
case NAVRELATION_PARENT_WINDOW_OF:
xpRelation = nsIAccessibleRelation::RELATION_PARENT_WINDOW_OF;
xpRelation = static_cast<int32_t>(RelationType::PARENT_WINDOW_OF);
break;
case NAVRELATION_DEFAULT_BUTTON:
xpRelation = nsIAccessibleRelation::RELATION_DEFAULT_BUTTON;
xpRelation = static_cast<int32_t>(RelationType::DEFAULT_BUTTON);
break;
case NAVRELATION_DESCRIBED_BY:
xpRelation = nsIAccessibleRelation::RELATION_DESCRIBED_BY;
xpRelation = static_cast<int32_t>(RelationType::DESCRIBED_BY);
break;
case NAVRELATION_DESCRIPTION_FOR:
xpRelation = nsIAccessibleRelation::RELATION_DESCRIPTION_FOR;
xpRelation = static_cast<int32_t>(RelationType::DESCRIPTION_FOR);
break;
case NAVRELATION_NODE_PARENT_OF:
xpRelation = nsIAccessibleRelation::RELATION_NODE_PARENT_OF;
xpRelation = static_cast<int32_t>(RelationType::NODE_PARENT_OF);
break;
default:
@ -979,7 +979,7 @@ AccessibleWrap::accNavigate(
pvarEndUpAt->vt = VT_EMPTY;
if (xpRelation >= 0) {
Relation rel = RelationByType(xpRelation);
Relation rel = RelationByType(static_cast<RelationType>(xpRelation));
navAccessible = rel.Next();
}

View File

@ -1,10 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
OS_CXXFLAGS += -DNOMINMAX
include $(topsrcdir)/config/rules.mk

View File

@ -23,6 +23,10 @@ LOCAL_INCLUDES += [
'../msaa',
]
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
DEFINES['NOMINMAX'] = True
LIBRARY_NAME = 'accessibility_toolkit_sdn_s'
EXPORT_LIBRARY = True

View File

@ -87,10 +87,10 @@ XULLabelAccessible::NativeState()
}
Relation
XULLabelAccessible::RelationByType(uint32_t aType)
XULLabelAccessible::RelationByType(RelationType aType)
{
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
if (aType == RelationType::LABEL_FOR) {
// Caption is the label for groupbox
nsIContent* parent = mContent->GetFlattenedTreeParent();
if (parent && parent->Tag() == nsGkAtoms::caption) {

View File

@ -26,7 +26,7 @@ public:
virtual void Shutdown();
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual Relation RelationByType(uint32_t aRelationType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
void UpdateLabelValue(const nsString& aValue);

View File

@ -385,7 +385,7 @@ XULGroupboxAccessible::NativeName(nsString& aName)
{
// XXX: we use the first related accessible only.
Accessible* label =
RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY).Next();
RelationByType(RelationType::LABELLED_BY).Next();
if (label)
return label->Name(aName);
@ -393,10 +393,10 @@ XULGroupboxAccessible::NativeName(nsString& aName)
}
Relation
XULGroupboxAccessible::RelationByType(uint32_t aType)
XULGroupboxAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
if (aType != RelationType::LABELLED_BY)
return rel;
// The label for xul:groupbox is generated from xul:label that is
@ -407,8 +407,7 @@ XULGroupboxAccessible::RelationByType(uint32_t aType)
Accessible* childAcc = GetChildAt(childIdx);
if (childAcc->Role() == roles::LABEL) {
// Ensure that it's our label
Relation reverseRel =
childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
Relation reverseRel = childAcc->RelationByType(RelationType::LABEL_FOR);
Accessible* testGroupbox = nullptr;
while ((testGroupbox = reverseRel.Next()))
if (testGroupbox == this) {

View File

@ -115,7 +115,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aRelationType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
// Accessible

View File

@ -108,10 +108,10 @@ XULTabAccessible::NativeInteractiveState() const
// nsIAccessible
Relation
XULTabAccessible::RelationByType(uint32_t aType)
XULTabAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
if (aType != RelationType::LABEL_FOR)
return rel;
// Expose 'LABEL_FOR' relation on tab accessible for tabpanel accessible.
@ -195,10 +195,10 @@ XULTabpanelAccessible::NativeRole()
}
Relation
XULTabpanelAccessible::RelationByType(uint32_t aType)
XULTabpanelAccessible::RelationByType(RelationType aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
if (aType != RelationType::LABELLED_BY)
return rel;
// Expose 'LABELLED_BY' relation on tabpanel accessible for tab accessible.

View File

@ -31,7 +31,7 @@ public:
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual uint64_t NativeInteractiveState() const;
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
// ActionAccessible
virtual uint8_t ActionCount();
@ -91,7 +91,7 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
};
} // namespace a11y

View File

@ -442,9 +442,9 @@ XULTreeAccessible::ChildCount() const
}
Relation
XULTreeAccessible::RelationByType(uint32_t aType)
XULTreeAccessible::RelationByType(RelationType aType)
{
if (aType == nsIAccessibleRelation::RELATION_NODE_PARENT_OF) {
if (aType == RelationType::NODE_PARENT_OF) {
if (mTreeView)
return Relation(new XULTreeItemIterator(this, mTreeView, -1));
@ -808,11 +808,11 @@ XULTreeItemAccessibleBase::TakeFocus()
}
Relation
XULTreeItemAccessibleBase::RelationByType(uint32_t aType)
XULTreeItemAccessibleBase::RelationByType(RelationType aType)
{
switch (aType) {
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
case RelationType::NODE_CHILD_OF: {
int32_t parentIndex = -1;
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
return Relation();
@ -824,7 +824,7 @@ XULTreeItemAccessibleBase::RelationByType(uint32_t aType)
return Relation(treeAcc->GetTreeItemAccessible(parentIndex));
}
case nsIAccessibleRelation::RELATION_NODE_PARENT_OF: {
case RelationType::NODE_PARENT_OF: {
bool isTrue = false;
if (NS_FAILED(mTreeView->IsContainerEmpty(mRow, &isTrue)) || isTrue)
return Relation();

View File

@ -50,7 +50,7 @@ public:
virtual Accessible* GetChildAt(uint32_t aIndex);
virtual uint32_t ChildCount() const;
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
// SelectAccessible
virtual already_AddRefed<nsIArray> SelectedItems();
@ -163,7 +163,7 @@ public:
virtual uint64_t NativeState();
virtual uint64_t NativeInteractiveState() const;
virtual int32_t IndexInParent() const;
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
virtual Accessible* FocusedChild();
// ActionAccessible

View File

@ -762,7 +762,7 @@ XULTreeGridCellAccessible::IndexInParent() const
}
Relation
XULTreeGridCellAccessible::RelationByType(uint32_t aType)
XULTreeGridCellAccessible::RelationByType(RelationType aType)
{
return Relation();
}

View File

@ -160,7 +160,7 @@ public:
virtual Accessible* FocusedChild();
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual int32_t IndexInParent() const;
virtual Relation RelationByType(uint32_t aType);
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
virtual uint64_t NativeInteractiveState() const;

View File

@ -157,8 +157,12 @@ let ErrorPage = {
observe: function errorPageObserve(aSubject, aTopic, aData) {
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
let mm = frameLoader.messageManager;
// This won't happen from dom/ipc/preload.js in non-OOP builds.
try {
mm.loadFrameScript(kErrorPageFrameScript, true);
if (Services.prefs.getBoolPref("dom.ipc.tabs.disabled") === true) {
mm.loadFrameScript(kErrorPageFrameScript, true);
}
} catch (e) {
dump('Error loading ' + kErrorPageFrameScript + ' as frame script: ' + e + '\n');
}

View File

@ -256,7 +256,6 @@ MediaEngineTabVideoSource::Draw() {
cairoData.mSurface = surf;
cairoData.mSize = size;
ImageFormat cairoFormat = CAIRO_SURFACE;
nsRefPtr<layers::CairoImage> image = new layers::CairoImage();
image->SetData(cairoData);

View File

@ -9,7 +9,6 @@
#include "gfxPoint.h"
#include "nsDebug.h"
#include "nsMemory.h"
#include "prtypes.h"
namespace mozilla {
@ -113,13 +112,13 @@ public:
* can simply do a bitwise uint32_t<->float copy.
*/
static float EncodeType(uint32_t aType) {
PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float));
static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same");
NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized");
return *(reinterpret_cast<float*>(&aType));
}
static uint32_t DecodeType(float aType) {
PR_STATIC_ASSERT(sizeof(uint32_t) == sizeof(float));
static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same");
uint32_t type = *(reinterpret_cast<uint32_t*>(&aType));
NS_ABORT_IF_FALSE(IsValidType(type), "Seg type not recognized");
return type;
@ -150,7 +149,7 @@ public:
PRUnichar('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
PRUnichar('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
};
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT);
static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
return table[aType];
}
@ -180,7 +179,7 @@ public:
2, // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
2 // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
};
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT);
static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
return table[aType];
}
@ -222,8 +221,8 @@ public:
// When adding a new path segment type, ensure that the returned condition
// below is still correct.
PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE ==
PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL);
static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,
"Unexpected type");
return aType >= PATHSEG_MOVETO_ABS;
}
@ -235,8 +234,8 @@ public:
// When adding a new path segment type, ensure that the returned condition
// below is still correct.
PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE ==
PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL);
static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,
"Unexpected type");
return aType & 1;
}
@ -248,8 +247,8 @@ public:
// When adding a new path segment type, ensure that the returned condition
// below is still correct.
PR_STATIC_ASSERT(NS_SVG_PATH_SEG_LAST_VALID_TYPE ==
PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL);
static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,
"Unexpected type");
return aType | 1;
}

View File

@ -1419,10 +1419,10 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id, bool *aI
if (JSID_IS_INT(id)) {
i = JSID_TO_INT(id);
} else {
jsval idval;
JS::RootedValue idval(cx);
double array_index;
if (!::JS_IdToValue(cx, id, &idval) ||
!::JS_ValueToNumber(cx, idval, &array_index) ||
if (!::JS_IdToValue(cx, id, idval.address()) ||
!JS::ToNumber(cx, idval, &array_index) ||
!::JS_DoubleIsInt32(array_index, &i)) {
return -1;
}

View File

@ -267,11 +267,11 @@ DOMProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid
int32_t
IdToInt32(JSContext* cx, JS::Handle<jsid> id)
{
JS::Value idval;
JS::RootedValue idval(cx);
double array_index;
int32_t i;
if (!::JS_IdToValue(cx, id, &idval) ||
!::JS_ValueToNumber(cx, idval, &array_index) ||
if (!::JS_IdToValue(cx, id, idval.address()) ||
!JS::ToNumber(cx, idval, &array_index) ||
!::JS_DoubleIsInt32(array_index, &i)) {
return -1;
}

View File

@ -24,9 +24,10 @@ docShell.setFullscreenAllowed(infos.fullscreenAllowed);
if (!('BrowserElementIsPreloaded' in this)) {
// This is a produc-specific file that's sometimes unavailable.
// Those are produc-specific files that's sometimes unavailable.
try {
Services.scriptloader.loadSubScript("chrome://browser/content/forms.js");
Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js");
} catch (e) {
}
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js");

View File

@ -320,6 +320,8 @@ BrowserElementChild.prototype = {
let returnValue = this._waitForResult(win);
Services.obs.notifyObservers(null, 'BEC:ShownModalPrompt', null);
if (args.promptType == 'prompt' ||
args.promptType == 'confirm' ||
args.promptType == 'custom-prompt') {

View File

@ -63,6 +63,8 @@ const ContentPanning = {
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._recvVisibilityChange.bind(this));
Services.obs.addObserver(this, "BEC:ShownModalPrompt", false);
},
handleEvent: function cp_handleEvent(evt) {
@ -110,6 +112,12 @@ const ContentPanning = {
}
},
observe: function cp_observe(subject, topic, data) {
if (topic === 'BEC:ShownModalPrompt') {
this._resetHover();
}
},
position: new Point(0 , 0),
findPrimaryPointer: function cp_findPrimaryPointer(touches) {
@ -496,6 +504,12 @@ const ContentPanning = {
this._setActive(root.documentElement);
},
_resetHover: function cp_resetHover() {
const kStateHover = 0x00000004;
let element = content.document.createElement('foo');
this._domUtils.setContentState(element, kStateHover);
},
_setActive: function cp_setActive(elt) {
const kStateActive = 0x00000001;
this._domUtils.setContentState(elt, kStateActive);
@ -581,6 +595,13 @@ const ContentPanning = {
}
},
_recvVisibilityChange: function(evt) {
if (!evt.target.hidden)
return;
this._resetHover();
},
_shouldZoomToElement: function(aElement) {
let win = aElement.ownerDocument.defaultView;
if (win.getComputedStyle(aElement, null).display == "inline")

View File

@ -218,7 +218,6 @@ MOCHITEST_FILES += \
test_browserElement_oop_PromptConfirm.html \
test_browserElement_oop_CookiesNotThirdParty.html \
test_browserElement_oop_Close.html \
test_browserElement_oop_CloseFromOpener.html \
test_browserElement_oop_CloseApp.html \
test_browserElement_oop_OpenWindow.html \
test_browserElement_oop_OpenWindowInFrame.html \
@ -244,6 +243,9 @@ MOCHITEST_FILES += \
test_browserElement_oop_BrowserWindowResize.html \
$(NULL)
# Disabled until bug 924771 makes it stop timing out
# test_browserElement_oop_CloseFromOpener.html \
# Disabled until we fix bug 906096.
# test_browserElement_oop_SetInputMethodActive.html \

View File

@ -5,7 +5,6 @@
#include "nsIDOMEventTarget.idl"
#include "SimToolKit.idl"
interface nsIDOMContact;
interface nsIDOMDOMRequest;
interface nsIDOMEventListener;
interface nsIDOMMozIccInfo;
@ -497,7 +496,7 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget
* PIN2 is only required for 'fdn'.
*/
nsIDOMDOMRequest updateContact(in DOMString contactType,
in nsISupports contact,
in jsval contact,
[optional] in DOMString pin2);
// End of UICC Phonebook Interfaces.

View File

@ -4,7 +4,6 @@
#include "nsISupports.idl"
interface nsIDOMContact;
interface nsIDOMDOMRequest;
interface nsIDOMMozIccInfo;
interface nsIDOMWindow;
@ -72,7 +71,7 @@ interface nsIIccProvider : nsISupports
nsIDOMDOMRequest updateContact(in nsIDOMWindow window,
in DOMString contactType,
in nsISupports contact,
in jsval contact,
in DOMString pin2);
/**

View File

@ -234,7 +234,7 @@ IccManager::ReadContacts(const nsAString& aContactType, nsIDOMDOMRequest** aRequ
NS_IMETHODIMP
IccManager::UpdateContact(const nsAString& aContactType,
nsISupports* aContact,
const JS::Value& aContact,
const nsAString& aPin2,
nsIDOMDOMRequest** aRequest)
{

View File

@ -0,0 +1,5 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_DOMTokenList-stringifier.html.json \
$(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,3 @@
{
"DOMTokenList stringifier": true
}

View File

@ -1,10 +1,7 @@
{
"DOMException exception: existence and properties of exception interface prototype object": true,
"DOMException exception: existence and properties of exception interface prototype object's \"name\" property": true,
"Event interface: document.createEvent(\"Event\") must inherit property \"timeStamp\" with the proper type (15)": true,
"Event interface: new Event(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true,
"CustomEvent interface: existence and properties of interface object": true,
"Event interface: new CustomEvent(\"foo\") must inherit property \"timeStamp\" with the proper type (15)": true,
"EventListener interface: existence and properties of interface prototype object": true,
"EventListener interface: existence and properties of interface prototype object's \"constructor\" property": true,
"EventListener interface: operation handleEvent(Event)": true,
@ -18,8 +15,6 @@
"Document interface: calling prepend([object Object],[object Object]) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: xmlDoc must inherit property \"append\" with the proper type (29)": true,
"Document interface: calling append([object Object],[object Object]) on xmlDoc with too few arguments must throw TypeError": true,
"DOMImplementation interface: operation createDocument(DOMString,DOMString,DocumentType)": true,
"DOMImplementation interface: calling createDocument(DOMString,DOMString,DocumentType) on document.implementation with too few arguments must throw TypeError": true,
"DocumentFragment interface: existence and properties of interface object": true,
"DocumentFragment interface: operation prepend([object Object],[object Object])": true,
"DocumentFragment interface: operation append([object Object],[object Object])": true,

View File

@ -1,6 +1,7 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
MOCHITEST_FILES := \
test_document.images.html.json \
test_document.title-03.html.json \
test_document.title-04.xhtml.json \
test_document.title-06.html.json \

View File

@ -0,0 +1,3 @@
{
"The empty string should not be in the collections": true
}

View File

@ -1,3 +1,23 @@
{
"itemType.remove must remove all useless whitespace": true,
"itemType.remove must collapse multiple whitespace around removed tokens": true,
"itemType.remove must remove duplicates when removing tokens": true,
"itemType.add must remove unused whitespace when the token already exists": true,
"itemType.add should normalize \\t as a space": true,
"itemType.add should normalize \\r as a space": true,
"itemType.add should normalize \\n as a space": true,
"itemType.add should normalize \\f as a space": true,
"itemProp.remove must remove all useless whitespace": true,
"itemProp.add must remove useless whitespace and duplicates when the token already exists": true,
"itemProp.add should normalize \\t as a space": true,
"itemProp.add should normalize \\r as a space": true,
"itemProp.add should normalize \\n as a space": true,
"itemProp.add should normalize \\f as a space": true,
"itemRef.remove must remove useless whitespace when removing tokens": true,
"itemRef.add must remove whitespace and duplicate when the token already exists": true,
"itemRef.add should normalize \\t as a space": true,
"itemRef.add should normalize \\r as a space": true,
"itemRef.add should normalize \\n as a space": true,
"itemRef.add should normalize \\f as a space": true,
"itemValue must reflect the src attribute on track elements": true
}

View File

@ -5,6 +5,7 @@ DIRS += [
'html/dom/collections',
'html/dom/errors',
'html/dom/events',
'html/dom/lists',
'html/dom/nodes',
'html/dom/nodes/Document-createElement-namespace-tests',
'html/dom/ranges',

View File

@ -0,0 +1,5 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
MOCHITEST_FILES := \
test_DOMTokenList-stringifier.html \
$(NULL)

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>DOMTokenList stringifier</title>
<link rel=help href="http://dom.spec.whatwg.org/#dom-domtokenlist-stringifier">
<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<span class=" a a b"></span>
<script>
test(function() {
var span = document.querySelector("span");
assert_equals(span.getAttribute("class"), " a a b",
"getAttribute should return the literal value");
assert_equals(span.className, " a a b",
"className should return the literal value");
assert_equals(String(span.classList), "a b",
"String(classList) should compress whitespace");
assert_equals(span.classList.toString(), "a b",
"classList.toString() should compress whitespace");
assert_class_string(span.classList, "DOMTokenList");
});
</script>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>DOMImplementation.createHTMLDocument</title>
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domimplementation-createhtmldocument">
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-documenttype-name">
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-documenttype-publicid">
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-documenttype-systemid">
<link rel=help href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-documentelement">
<link rel=help href="http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument">
<link rel=help href="http://dom.spec.whatwg.org/#dom-documenttype-name">
<link rel=help href="http://dom.spec.whatwg.org/#dom-documenttype-publicid">
<link rel=help href="http://dom.spec.whatwg.org/#dom-documenttype-systemid">
<link rel=help href="http://dom.spec.whatwg.org/#dom-document-documentelement">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

View File

@ -24,7 +24,8 @@ test(function() {
assert_throws(new TypeError(), function() { attr.appendChild(document.createTextNode("fail")) })
assert_throws(new TypeError(), function() { attr.appendChild(null) })
assert_equals(attr.value, "pass")
assert_false("childNodes" in attr)
assert_false("childNodes" in attr, "Should not have childNodes")
assert_false("textContent" in attr, "Should not have textContent")
}, "AttrExodus")
// setAttribute exhaustive tests

View File

@ -61,7 +61,7 @@ interface Event {
readonly attribute boolean defaultPrevented;
[Unforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMTimeStamp timeStamp;
readonly attribute /* DOMTimeStamp */ unsigned long long timeStamp;
void initEvent(DOMString type, boolean bubbles, boolean cancelable);
};
@ -245,7 +245,7 @@ interface XMLDocument : Document {};
interface DOMImplementation {
DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype);
XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
Document createHTMLDocument(optional DOMString title);
boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version);

View File

@ -8,6 +8,7 @@ MOCHITEST_FILES := \
test_document.getElementsByClassName-same.html \
test_document.head-01.html \
test_document.head-02.html \
test_document.images.html \
test_document.title-01.html \
test_document.title-02.xhtml \
test_document.title-03.html \

View File

@ -0,0 +1,105 @@
<!doctype html>
<meta charset=utf-8>
<title>Document.images</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<div id=test>
<img>
<img id=x><img name=y><img id=z1 name=z2>
<img id=a><img id=a>
<img name=b><img name=b>
<img id=><img name=>
<input type=image name=input>
</div>
<script>
function assert_all(aAssertFunc, aCollection) {
for (var i = 0; i < aCollection.length; ++i) {
aAssertFunc(aCollection[i]);
}
}
var XHTML = "http://www.w3.org/1999/xhtml";
var div, images, c;
setup(function() {
div = document.getElementById("test");
var foreign =
div.appendChild(document.createElementNS("http://example.org", "img"));
foreign.setAttribute("id", "f");
images = [].slice.call(div.getElementsByTagNameNS(XHTML, "img"));
c = document.images;
});
test(function() {
assert_equals(c.length, 10);
assert_array_equals(c, images);
assert_all(function (aElement) {
assert_equals(aElement.namespaceURI, XHTML);
}, c);
}, "document.images should contain all HTML img elements");
test(function() {
assert_equals(c.x, images[1]);
assert_equals(c.namedItem("x"), images[1]);
assert_true("x" in c, '"x" in c');
}, "img with id");
test(function() {
assert_equals(c.y, images[2]);
assert_equals(c.namedItem("y"), images[2]);
assert_true("y" in c, '"y" in c');
}, "img with name");
test(function() {
assert_equals(c.z1, images[3]);
assert_equals(c.namedItem("z1"), images[3]);
assert_true("z1" in c, '"z1" in c');
assert_equals(c.z2, images[3]);
assert_equals(c.namedItem("z2"), images[3]);
assert_true("z2" in c, '"z2" in c');
}, "img with id and name");
test(function() {
assert_equals(c.a, images[4]);
assert_equals(c.namedItem("a"), images[4]);
assert_true("a" in c, '"a" in c');
}, "Two img elements with the same id");
test(function() {
assert_equals(c.b, images[6]);
assert_equals(c.namedItem("b"), images[6]);
assert_true("b" in c, '"b" in c');
}, "Two img elements with the same name");
test(function() {
assert_equals(c.c, undefined);
assert_equals(c.namedItem("c"), null);
assert_false("c" in c, '"c" in c');
}, "Unknown name should not be in the collection");
test(function() {
assert_equals(c.f, undefined);
assert_equals(c.namedItem("f"), null);
assert_false("f" in c, '"f" in c');
}, "Foreign element should not be in the collection");
test(function() {
assert_equals(c.input, undefined);
assert_equals(c.namedItem("input"), null);
assert_false("input" in c, '"input" in c');
var input = div.getElementsByTagName("input")[0];
assert_all(function (aElement) {
assert_not_equals(aElement.namespaceURI, input);
}, c);
}, "Input elements should not be in the collection");
test(function() {
assert_equals(c[""], undefined);
assert_equals(c.namedItem(""), null);
assert_false("" in c, '"" in c');
}, "The empty string should not be in the collections");
</script>

View File

@ -18,4 +18,9 @@ checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz")
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz")
checkDoc("foo\f\fbar baz", "foo\f\fbar baz", "foo bar baz")
checkDoc("foo\r\rbar baz", "foo\r\rbar baz", "foo bar baz")
test(function() {
var doc = document.implementation.createHTMLDocument()
assert_equals(doc.title, "")
}, "Missing title argument");
</script>

View File

@ -387,23 +387,28 @@ test(function () {
test(function () {
var elem = makeEl('div',{itemtype:' token1 token2 '});
elem.itemType.remove('token2');
assert_equals( elem.itemType.toString(), ' token1' );
}, 'itemType.remove must only remove whitespace around removed tokens');
assert_equals( elem.itemType.toString(), 'token1' );
}, 'itemType.remove must remove all useless whitespace');
test(function () {
var elem = makeEl('div',{itemtype:' token1 token2 token1 '});
var elem = makeEl('div',{itemtype:' token1 token2 token3 '});
elem.itemType.remove('token2');
assert_equals( elem.itemType.toString(), ' token1 token1 ' );
assert_equals( elem.itemType.toString(), 'token1 token3' );
}, 'itemType.remove must collapse multiple whitespace around removed tokens');
test(function () {
var elem = makeEl('div',{itemtype:' token1 token2 token1 '});
elem.itemType.remove('token1');
elem.itemType.remove('token2');
assert_equals( elem.itemType.toString(), 'token1' );
}, 'itemType.remove must remove duplicates when removing tokens');
test(function () {
var elem = makeEl('div',{itemtype:' token1 token2 token3 '});
elem.itemType.remove('token1', 'token3');
assert_equals( elem.itemType.toString(), 'token2' );
}, 'itemType.remove must collapse whitespace when removing multiple tokens');
test(function () {
var elem = makeEl('div',{itemtype:' token1 token1 '});
var elem = makeEl('div',{itemtype:' token1 token2 '});
elem.itemType.add('token1');
assert_equals( elem.itemType.toString(), ' token1 token1 ' );
}, 'itemType.add must not affect whitespace when the token already exists');
assert_equals( elem.itemType.toString(), 'token1 token2' );
}, 'itemType.add must remove unused whitespace when the token already exists');
test(function () {
var elem = makeEl('div',{itemtype:'FOO'});
assert_true(elem.itemType.toggle('foo'));
@ -456,23 +461,23 @@ test(function () {
test(function () {
var elem = makeEl('div',{itemtype:'a\t'});
elem.itemType.add('b');
assert_equals(elem.itemType.toString(),'a\tb');
}, 'itemType.add should treat \\t as a space');
assert_equals(elem.itemType.toString(),'a b');
}, 'itemType.add should normalize \\t as a space');
test(function () {
var elem = makeEl('div',{itemtype:'a\r'});
elem.itemType.add('b');
assert_equals(elem.itemType.toString(),'a\rb');
}, 'itemType.add should treat \\r as a space');
assert_equals(elem.itemType.toString(),'a b');
}, 'itemType.add should normalize \\r as a space');
test(function () {
var elem = makeEl('div',{itemtype:'a\n'});
elem.itemType.add('b');
assert_equals(elem.itemType.toString(),'a\nb');
}, 'itemType.add should treat \\n as a space');
assert_equals(elem.itemType.toString(),'a b');
}, 'itemType.add should normalize \\n as a space');
test(function () {
var elem = makeEl('div',{itemtype:'a\f'});
elem.itemType.add('b');
assert_equals(elem.itemType.toString(),'a\fb');
}, 'itemType.add should treat \\f as a space');
assert_equals(elem.itemType.toString(),'a b');
}, 'itemType.add should normalize \\f as a space');
test(function () {
var elem = makeEl('div',{itemtype:'foo'});
elem.itemType.remove('foo');
@ -675,25 +680,20 @@ test(function () {
assert_equals( elem.itemProp.toString(), 'token1 token3' );
}, 'itemProp.remove must collapse whitespace around removed tokens');
test(function () {
var elem = makeEl('div',{itemprop:' token1 token2 '});
var elem = makeEl('div',{itemprop:' token1 token2 token3 '});
elem.itemProp.remove('token2');
assert_equals( elem.itemProp.toString(), ' token1' );
}, 'itemProp.remove must only remove whitespace around removed tokens');
assert_equals( elem.itemProp.toString(), 'token1 token3' );
}, 'itemProp.remove must remove all useless whitespace');
test(function () {
var elem = makeEl('div',{itemprop:' token1 token2 token1 '});
elem.itemProp.remove('token2');
assert_equals( elem.itemProp.toString(), ' token1 token1 ' );
}, 'itemProp.remove must collapse multiple whitespace around removed tokens');
test(function () {
var elem = makeEl('div',{itemprop:' token1 token2 token1 '});
elem.itemProp.remove('token1');
var elem = makeEl('div',{itemprop:' token1 token2 token3 '});
elem.itemProp.remove('token1', 'token3');
assert_equals( elem.itemProp.toString(), 'token2' );
}, 'itemProp.remove must collapse whitespace when removing multiple tokens');
}, 'itemProp.remove must remove useless whitespace when removing multiple tokens');
test(function () {
var elem = makeEl('div',{itemprop:' token1 token1 '});
elem.itemProp.add('token1');
assert_equals( elem.itemProp.toString(), ' token1 token1 ' );
}, 'itemProp.add must not affect whitespace when the token already exists');
assert_equals( elem.itemProp.toString(), 'token1' );
}, 'itemProp.add must remove useless whitespace and duplicates when the token already exists');
test(function () {
var elem = makeEl('div',{itemprop:'FOO'});
assert_true(elem.itemProp.toggle('foo'));
@ -746,23 +746,23 @@ test(function () {
test(function () {
var elem = makeEl('div',{itemprop:'a\t'});
elem.itemProp.add('b');
assert_equals(elem.itemProp.toString(),'a\tb');
}, 'itemProp.add should treat \\t as a space');
assert_equals(elem.itemProp.toString(),'a b');
}, 'itemProp.add should normalize \\t as a space');
test(function () {
var elem = makeEl('div',{itemprop:'a\r'});
elem.itemProp.add('b');
assert_equals(elem.itemProp.toString(),'a\rb');
}, 'itemProp.add should treat \\r as a space');
assert_equals(elem.itemProp.toString(),'a b');
}, 'itemProp.add should normalize \\r as a space');
test(function () {
var elem = makeEl('div',{itemprop:'a\n'});
elem.itemProp.add('b');
assert_equals(elem.itemProp.toString(),'a\nb');
}, 'itemProp.add should treat \\n as a space');
assert_equals(elem.itemProp.toString(),'a b');
}, 'itemProp.add should normalize \\n as a space');
test(function () {
var elem = makeEl('div',{itemprop:'a\f'});
elem.itemProp.add('b');
assert_equals(elem.itemProp.toString(),'a\fb');
}, 'itemProp.add should treat \\f as a space');
assert_equals(elem.itemProp.toString(),'a b');
}, 'itemProp.add should normalize \\f as a space');
test(function () {
var elem = makeEl('div',{itemprop:'foo'});
elem.itemProp.remove('foo');
@ -1009,23 +1009,23 @@ test(function () {
test(function () {
var elem = makeEl('div',{itemref:' token1 token2 '});
elem.itemRef.remove('token2');
assert_equals( elem.itemRef.toString(), ' token1' );
}, 'itemRef.remove must only remove whitespace around removed tokens');
assert_equals( elem.itemRef.toString(), 'token1' );
}, 'itemRef.remove must remove useless whitespace when removing tokens');
test(function () {
var elem = makeEl('div',{itemref:' token1 token2 token1 '});
var elem = makeEl('div',{itemref:' token1 token2 token3 '});
elem.itemRef.remove('token2');
assert_equals( elem.itemRef.toString(), ' token1 token1 ' );
}, 'itemRef.remove must collapse multiple whitespace around removed tokens');
assert_equals( elem.itemRef.toString(), 'token1 token3' );
}, 'itemRef.remove must remove useless whitespace when removing tokens');
test(function () {
var elem = makeEl('div',{itemref:' token1 token2 token1 '});
elem.itemRef.remove('token1');
var elem = makeEl('div',{itemref:' token1 token2 token3 '});
elem.itemRef.remove('token1', 'token3');
assert_equals( elem.itemRef.toString(), 'token2' );
}, 'itemRef.remove must collapse whitespace when removing multiple tokens');
test(function () {
var elem = makeEl('div',{itemref:' token1 token1 '});
elem.itemRef.add('token1');
assert_equals( elem.itemRef.toString(), ' token1 token1 ' );
}, 'itemRef.add must not affect whitespace when the token already exists');
assert_equals( elem.itemRef.toString(), 'token1' );
}, 'itemRef.add must remove whitespace and duplicate when the token already exists');
test(function () {
var elem = makeEl('div',{itemref:'FOO'});
assert_true(elem.itemRef.toggle('foo'));
@ -1078,23 +1078,23 @@ test(function () {
test(function () {
var elem = makeEl('div',{itemref:'a\t'});
elem.itemRef.add('b');
assert_equals(elem.itemRef.toString(),'a\tb');
}, 'itemRef.add should treat \\t as a space');
assert_equals(elem.itemRef.toString(),'a b');
}, 'itemRef.add should normalize \\t as a space');
test(function () {
var elem = makeEl('div',{itemref:'a\r'});
elem.itemRef.add('b');
assert_equals(elem.itemRef.toString(),'a\rb');
}, 'itemRef.add should treat \\r as a space');
assert_equals(elem.itemRef.toString(),'a b');
}, 'itemRef.add should normalize \\r as a space');
test(function () {
var elem = makeEl('div',{itemref:'a\n'});
elem.itemRef.add('b');
assert_equals(elem.itemRef.toString(),'a\nb');
}, 'itemRef.add should treat \\n as a space');
assert_equals(elem.itemRef.toString(),'a b');
}, 'itemRef.add should normalize \\n as a space');
test(function () {
var elem = makeEl('div',{itemref:'a\f'});
elem.itemRef.add('b');
assert_equals(elem.itemRef.toString(),'a\fb');
}, 'itemRef.add should treat \\f as a space');
assert_equals(elem.itemRef.toString(),'a b');
}, 'itemRef.add should normalize \\f as a space');
test(function () {
var elem = makeEl('div',{itemref:'foo'});
elem.itemRef.remove('foo');

View File

@ -10,6 +10,7 @@ DIRS += [
'failures/html/dom',
'failures/html/dom/collections',
'failures/html/dom/errors',
'failures/html/dom/lists',
'failures/html/dom/nodes',
'failures/html/dom/ranges',
'failures/html/html/browsers/the-window-object',

View File

@ -91,9 +91,10 @@ const BrowserElementIsPreloaded = true;
} catch(e) {
}
// This is a produc-specific file that's sometimes unavailable.
// Those are produc-specific files that's sometimes unavailable.
try {
Services.scriptloader.loadSubScript("chrome://browser/content/forms.js", global);
Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js", global);
} catch (e) {
}
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js", global);

View File

@ -891,6 +891,7 @@ RTCError.prototype = {
// This is a separate object because we don't want to expose it to DOM.
function PeerConnectionObserver() {
this._dompc = null;
this._guard = new WeakReferent(this);
}
PeerConnectionObserver.prototype = {
classDescription: "PeerConnectionObserver",
@ -1192,9 +1193,23 @@ PeerConnectionObserver.prototype = {
getSupportedConstraints: function(dict) {
return dict;
},
get weakReferent() {
return this._guard;
}
};
// A PeerConnectionObserver member that c++ can do weak references on
function WeakReferent(parent) {
this._parent = parent; // prevents parent from going away without us
}
WeakReferent.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsISupportsWeakReference]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
[GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection,
RTCStatsReport, PeerConnectionObserver]

View File

@ -1,14 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
LOCAL_INCLUDES += \
-I$(topsrcdir)/media/mtransport \
-I$(topsrcdir)/media/webrtc/signaling/include \
-I$(topsrcdir)/media/webrtc/signaling/src/sipcc/include \
-I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
-I$(topsrcdir)/media/webrtc/signaling/src/mediapipeline \
-I$(topsrcdir)/media/webrtc/signaling/src/media-conduit \
-I$(topsrcdir)/media/webrtc/signaling/src/common/time_profiling \
-I$(topsrcdir)/ipc/chromium/src \
$(NULL)

View File

@ -14,6 +14,17 @@ CPP_SOURCES += [
'MediaModule.cpp',
]
LOCAL_INCLUDES += [
'/ipc/chromium/src',
'/media/mtransport',
'/media/webrtc/signaling/include',
'/media/webrtc/signaling/src/common/time_profiling',
'/media/webrtc/signaling/src/media-conduit',
'/media/webrtc/signaling/src/mediapipeline',
'/media/webrtc/signaling/src/peerconnection',
'/media/webrtc/signaling/src/sipcc/include',
]
LIBRARY_NAME = 'peerconnection'
LIBXUL_LIBRARY = True

View File

@ -1,6 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# We fire the nsDOMDeviceAcceleration
LOCAL_INCLUDES += -I$(topsrcdir)/content/events/src

View File

@ -10,6 +10,11 @@ CPP_SOURCES += [
'nsHapticFeedback.cpp',
]
# We fire the nsDOMDeviceAcceleration
LOCAL_INCLUDES += [
'/content/events/src',
]
FAIL_ON_WARNINGS = True
LIBXUL_LIBRARY = True

View File

@ -4,6 +4,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface nsISupports;
[ChromeOnly,
JSImplementation="@mozilla.org/dom/peerconnectionobserver;1",
Constructor (object domPC)]
@ -40,6 +42,9 @@ interface PeerConnectionObserver
void onAddTrack();
void onRemoveTrack();
/* Used by c++ to know when Observer goes away */
readonly attribute nsISupports weakReferent;
/* Helper function to access supported constraints defined in webidl. Needs to
* be in a separate webidl object we hold, so putting it here was convenient.
*/

View File

@ -4646,7 +4646,8 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp,
// See if any of the optional arguments were passed.
if (aArgc > 1) {
double intervalMS = 0;
if (!JS_ValueToNumber(aCx, argv[1], &intervalMS)) {
JS::RootedValue interval(aCx, argv[1]);
if (!JS::ToNumber(aCx, interval, &intervalMS)) {
return false;
}
newInfo->mInterval = TimeDuration::FromMilliseconds(intervalMS);

View File

@ -1,5 +0,0 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -1,8 +0,0 @@
# vim:set ts=8 sw=8 sts=8 noet:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifeq ($(OS_ARCH),WINNT)
LOCAL_INCLUDES += -DUSE_SSPI
endif

View File

@ -17,6 +17,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
CPP_SOURCES += [
'nsAuthSSPI.cpp',
]
DEFINES['USE_SSPI'] = True
else:
CPP_SOURCES += [
'nsAuthSambaNTLM.cpp',

View File

@ -1,4 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -578,6 +578,15 @@ public:
virtual TemporaryRef<SourceSurface> Snapshot() = 0;
virtual IntSize GetSize() = 0;
/**
* If possible returns the bits to this DrawTarget for direct manipulation. While
* the bits is locked any modifications to this DrawTarget is forbidden.
* Release takes the original data pointer for safety.
*/
virtual bool LockBits(uint8_t** aData, IntSize* aSize,
int32_t* aStride, SurfaceFormat* aFormat) { return false; }
virtual void ReleaseBits(uint8_t* aData) {}
/* Ensure that the DrawTarget backend has flushed all drawing operations to
* this draw target. This must be called before using the backing surface of
* this draw target outside of GFX 2D code.

View File

@ -399,6 +399,7 @@ NeedIntermediateSurface(const Pattern& aPattern, const DrawOptions& aOptions)
DrawTargetCairo::DrawTargetCairo()
: mContext(nullptr)
, mLockedBits(nullptr)
{
}
@ -408,6 +409,7 @@ DrawTargetCairo::~DrawTargetCairo()
if (mSurface) {
cairo_surface_destroy(mSurface);
}
MOZ_ASSERT(!mLockedBits);
}
IntSize
@ -433,6 +435,31 @@ DrawTargetCairo::Snapshot()
return mSnapshot;
}
bool
DrawTargetCairo::LockBits(uint8_t** aData, IntSize* aSize,
int32_t* aStride, SurfaceFormat* aFormat)
{
if (cairo_surface_get_type(mSurface) == CAIRO_SURFACE_TYPE_IMAGE) {
WillChange();
mLockedBits = cairo_image_surface_get_data(mSurface);
*aData = mLockedBits;
*aSize = GetSize();
*aStride = cairo_image_surface_get_stride(mSurface);
*aFormat = GetFormat();
return true;
}
return false;
}
void
DrawTargetCairo::ReleaseBits(uint8_t* aData)
{
MOZ_ASSERT(mLockedBits == aData);
mLockedBits = nullptr;
}
void
DrawTargetCairo::Flush()
{
@ -1152,6 +1179,7 @@ void
DrawTargetCairo::WillChange(const Path* aPath /* = nullptr */)
{
MarkSnapshotIndependent();
MOZ_ASSERT(!mLockedBits);
}
void

View File

@ -60,6 +60,10 @@ public:
virtual TemporaryRef<SourceSurface> Snapshot();
virtual IntSize GetSize();
virtual bool LockBits(uint8_t** aData, IntSize* aSize,
int32_t* aStride, SurfaceFormat* aFormat);
virtual void ReleaseBits(uint8_t* aData);
virtual void Flush();
virtual void DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
@ -185,6 +189,8 @@ private: // data
cairo_surface_t* mSurface;
IntSize mSize;
uint8_t* mLockedBits;
// The latest snapshot of this surface. This needs to be told when this
// target is modified. We keep it alive as a cache.
RefPtr<SourceSurfaceCairo> mSnapshot;

View File

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <algorithm> // min & max
#include <cstdlib>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
void BufferUnrotate(uint8_t* aBuffer, int aByteWidth, int aHeight,
int aByteStride, int aXBoundary, int aYBoundary)
{
if (aXBoundary != 0) {
uint8_t* line = new uint8_t[aByteWidth];
uint32_t smallStart = 0;
uint32_t smallLen = aXBoundary;
uint32_t smallDest = aByteWidth - aXBoundary;
uint32_t largeStart = aXBoundary;
uint32_t largeLen = aByteWidth - aXBoundary;
uint32_t largeDest = 0;
if (aXBoundary > aByteWidth / 2) {
smallStart = aXBoundary;
smallLen = aByteWidth - aXBoundary;
smallDest = 0;
largeStart = 0;
largeLen = aXBoundary;
largeDest = smallLen;
}
for (int y = 0; y < aHeight; y++) {
int yOffset = y * aByteStride;
memcpy(line, &aBuffer[yOffset + smallStart], smallLen);
memmove(&aBuffer[yOffset + largeDest], &aBuffer[yOffset + largeStart], largeLen);
memcpy(&aBuffer[yOffset + smallDest], line, smallLen);
}
delete[] line;
}
if (aYBoundary != 0) {
uint32_t smallestHeight = std::min(aHeight - aYBoundary, aYBoundary);
uint32_t largestHeight = std::max(aHeight - aYBoundary, aYBoundary);
uint32_t smallOffset = 0;
uint32_t largeOffset = aYBoundary * aByteStride;
uint32_t largeDestOffset = 0;
uint32_t smallDestOffset = largestHeight * aByteStride;
if (aYBoundary > aHeight / 2) {
smallOffset = aYBoundary * aByteStride;
largeOffset = 0;
largeDestOffset = smallestHeight * aByteStride;
smallDestOffset = 0;
}
uint8_t* smallestSide = new uint8_t[aByteStride * smallestHeight];
memcpy(smallestSide, &aBuffer[smallOffset], aByteStride * smallestHeight);
memmove(&aBuffer[largeDestOffset], &aBuffer[largeOffset], aByteStride * largestHeight);
memcpy(&aBuffer[smallDestOffset], smallestSide, aByteStride * smallestHeight);
delete[] smallestSide;
}
}

View File

@ -0,0 +1,14 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_BUFFERUNROTATE_H
#define GFX_BUFFERUNROTATE_H
#include "mozilla/Types.h"
void BufferUnrotate(uint8_t* aBuffer, int aByteWidth, int aHeight,
int aByteStride, int aXByteBoundary, int aYBoundary);
#endif // GFX_BUFFERUNROTATE_H

View File

@ -8,6 +8,7 @@
#include <algorithm> // for max
#include "BasicImplData.h" // for BasicImplData
#include "BasicLayersImpl.h" // for ToData
#include "BufferUnrotate.h" // for BufferUnrotate
#include "GeckoProfiler.h" // for PROFILER_LABEL
#include "Layers.h" // for ThebesLayer, Layer, etc
#include "gfxColor.h" // for gfxRGBA
@ -675,18 +676,54 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
}
}
result.mDidSelfCopy = true;
mDidSelfCopy = true;
// Don't set destBuffer; we special-case self-copies, and
// just did the necessary work above.
mBufferRect = destBufferRect;
} else {
// We can't do a real self-copy because the buffer is rotated.
// So allocate a new buffer for the destination.
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
CreateBuffer(contentType, destBufferRect, bufferFlags,
getter_AddRefs(destBuffer), getter_AddRefs(destBufferOnWhite),
&destDTBuffer, &destDTBufferOnWhite);
if (!destBuffer && !destDTBuffer)
return result;
// With azure and a data surface perform an buffer unrotate
// (SelfCopy).
if (IsAzureBuffer()) {
unsigned char* data;
IntSize size;
int32_t stride;
SurfaceFormat format;
if (mDTBuffer->LockBits(&data, &size, &stride, &format)) {
uint8_t bytesPerPixel = BytesPerPixel(format);
BufferUnrotate(data,
size.width * bytesPerPixel,
size.height, stride,
newRotation.x * bytesPerPixel, newRotation.y);
mDTBuffer->ReleaseBits(data);
if (mode == Layer::SURFACE_COMPONENT_ALPHA) {
mDTBufferOnWhite->LockBits(&data, &size, &stride, &format);
uint8_t bytesPerPixel = BytesPerPixel(format);
BufferUnrotate(data,
size.width * bytesPerPixel,
size.height, stride,
newRotation.x * bytesPerPixel, newRotation.y);
mDTBufferOnWhite->ReleaseBits(data);
}
// Buffer unrotate moves all the pixels, note that
// we self copied for SyncBackToFrontBuffer
result.mDidSelfCopy = true;
mDidSelfCopy = true;
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0, 0);
}
}
if (!result.mDidSelfCopy) {
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
CreateBuffer(contentType, destBufferRect, bufferFlags,
getter_AddRefs(destBuffer), getter_AddRefs(destBufferOnWhite),
&destDTBuffer, &destDTBufferOnWhite);
if (!destBuffer && !destDTBuffer)
return result;
}
}
} else {
mBufferRect = destBufferRect;

View File

@ -146,6 +146,9 @@ protected:
* buffer at the other end, not 2D rotation!
*/
nsIntPoint mBufferRotation;
// When this is true it means that all pixels have moved inside the buffer.
// It's not possible to sync with another buffer without a full copy.
bool mDidSelfCopy;
};
/**

View File

@ -479,21 +479,13 @@ ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
nsIntRegion updateRegion = mFrontUpdatedRegion;
int32_t xBoundary = mBufferRect.XMost() - mBufferRotation.x;
int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y;
// Figure out whether the area we want to copy wraps the edges of our buffer.
bool needFullCopy = (xBoundary < updateRegion.GetBounds().XMost() &&
xBoundary > updateRegion.GetBounds().x) ||
(yBoundary < updateRegion.GetBounds().YMost() &&
yBoundary > updateRegion.GetBounds().y);
// This is a tricky trade off, we're going to get stuff out of our
// frontbuffer now, but the next PaintThebes might throw it all (or mostly)
// away if the visible region has changed. This is why in reality we want
// this code integrated with PaintThebes to always do the optimal thing.
if (needFullCopy) {
if (mDidSelfCopy) {
mDidSelfCopy = false;
// We can't easily draw our front buffer into us, since we're going to be
// copying stuff around anyway it's easiest if we just move our situation
// to non-rotated while we're at it. If this situation occurs we'll have

View File

@ -100,7 +100,6 @@ ImageBridgeParent::RecvUpdateNoSwap(const EditArray& aEdits)
return success;
}
static void
ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge,
Transport* aTransport,
@ -179,8 +178,6 @@ bool ImageBridgeParent::DeallocPCompositableParent(PCompositableParent* aActor)
return true;
}
MessageLoop * ImageBridgeParent::GetMessageLoop() {
return mMessageLoop;
}
@ -198,7 +195,7 @@ ImageBridgeParent::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds
mozilla::ipc::ProtocolCloneContext* aCtx)
{
for (unsigned int i = 0; i < aFds.Length(); i++) {
if (aFds[i].protocolId() == (int)GetProtocolId()) {
if (aFds[i].protocolId() == unsigned(GetProtocolId())) {
Transport* transport = OpenDescriptor(aFds[i].fd(),
Transport::MODE_SERVER);
PImageBridgeParent* bridge = Create(transport, base::GetProcId(aPeerProcess));

View File

@ -194,6 +194,7 @@ CPP_SOURCES += [
'basic/BasicLayerManager.cpp',
'basic/BasicLayersImpl.cpp',
'basic/BasicThebesLayer.cpp',
'BufferUnrotate.cpp',
'client/CanvasClient.cpp',
'composite/CanvasLayerComposite.cpp',
'opengl/CanvasLayerOGL.cpp',

View File

@ -39,7 +39,6 @@
#include "nsRect.h" // for nsIntRect
#include "nsServiceManagerUtils.h" // for do_GetService
#include "nsString.h" // for nsString, nsAutoCString, etc
#include "prtypes.h" // for PR_INT32_MAX
#if MOZ_ANDROID_OMTC
#include "TexturePoolOGL.h"
@ -1356,7 +1355,7 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfxMatrix& aTransform)
GLint width = rect.width;
GLint height = rect.height;
if ((int64_t(width) * int64_t(height) * int64_t(4)) > PR_INT32_MAX) {
if ((int64_t(width) * int64_t(height) * int64_t(4)) > INT32_MAX) {
NS_ERROR("Widget size too big - integer overflow!");
return;
}

View File

@ -10,7 +10,6 @@
#include <stdint.h> // for uint8_t, uint32_t
#include "gfxCore.h" // for NS_GFX_
#include "nscore.h" // for nsAString
#include "prtypes.h" // for PR_BEGIN_MACRO, etc
class nsAString;
class nsString;

View File

@ -14,7 +14,6 @@
#include "nsMemory.h" // for NS_ARRAY_LENGTH
#include "nsUnicharUtils.h"
#include "nscore.h" // for PRUnichar
#include "prtypes.h" // for PR_STATIC_ASSERT
#include "mozilla/gfx/2D.h"
nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
@ -255,8 +254,9 @@ const gfxFontFeature eastAsianDefaults[] = {
{ TRUETYPE_TAG('r','u','b','y'), 1 }
};
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(eastAsianDefaults) ==
eFeatureEastAsian_numFeatures);
static_assert(NS_ARRAY_LENGTH(eastAsianDefaults) ==
eFeatureEastAsian_numFeatures,
"eFeatureEastAsian_numFeatures should be correct");
// NS_FONT_VARIANT_LIGATURES_xxx values
const gfxFontFeature ligDefaults[] = {
@ -270,8 +270,9 @@ const gfxFontFeature ligDefaults[] = {
{ TRUETYPE_TAG('c','a','l','t'), 0 }
};
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(ligDefaults) ==
eFeatureLigatures_numFeatures);
static_assert(NS_ARRAY_LENGTH(ligDefaults) ==
eFeatureLigatures_numFeatures,
"eFeatureLigatures_numFeatures should be correct");
// NS_FONT_VARIANT_NUMERIC_xxx values
const gfxFontFeature numericDefaults[] = {
@ -285,8 +286,9 @@ const gfxFontFeature numericDefaults[] = {
{ TRUETYPE_TAG('o','r','d','n'), 1 }
};
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(numericDefaults) ==
eFeatureNumeric_numFeatures);
static_assert(NS_ARRAY_LENGTH(numericDefaults) ==
eFeatureNumeric_numFeatures,
"eFeatureNumeric_numFeatures should be correct");
static void
AddFontFeaturesBitmask(uint32_t aValue, uint32_t aMin, uint32_t aMax,

View File

@ -7,11 +7,10 @@
#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsString.h" // for nsAutoString, etc
#include "prtypes.h" // for PR_STATIC_ASSERT
#include "nsMargin.h" // for nsMargin
// the mozilla::css::Side sequence must match the nsMargin nscoord sequence
PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
static_assert((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3),
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
#ifdef DEBUG
// Diagnostics

View File

@ -0,0 +1,151 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gtest/gtest.h"
#include "BufferUnrotate.h"
static unsigned char* GenerateBuffer(int bytesPerPixel,
int width, int height,
int stride, int xBoundary, int yBoundary)
{
unsigned char* buffer = new unsigned char[stride*height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pos = ((yBoundary + y) % height) * stride +
((xBoundary + x) % width) * bytesPerPixel;
for (int i = 0; i < bytesPerPixel; i++) {
buffer[pos+i] = (x+y+i*2)%256;
}
}
}
return buffer;
}
static bool CheckBuffer(unsigned char* buffer, int bytesPerPixel,
int width, int height, int stride)
{
int xBoundary = 0;
int yBoundary = 0;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pos = ((yBoundary + y) % height) * stride +
((xBoundary + x) % width) * bytesPerPixel;
for (int i = 0; i < bytesPerPixel; i++) {
if (buffer[pos+i] != (x+y+i*2)%256) {
printf("Buffer differs at %i, %i, is %i\n", x, y, (int)buffer[pos+i]);
return false;
}
}
}
}
return true;
}
TEST(Gfx, BufferUnrotateHorizontal) {
const int NUM_OF_TESTS = 8;
int bytesPerPixelList[2] = {2,4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99};
int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99};
int xBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31};
int yBoundary[NUM_OF_TESTS] = {0, 0, 0, 0};
for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) {
int bytesPerPixel = bytesPerPixelList[bytesPerId];
int stride = 256 * bytesPerPixel;
for (int testId = 0; testId < NUM_OF_TESTS; testId++) {
unsigned char* buffer = GenerateBuffer(bytesPerPixel,
width[testId], height[testId], stride,
xBoundary[testId], yBoundary[testId]);
BufferUnrotate(buffer,
width[testId] * bytesPerPixel, height[testId], stride,
xBoundary[testId] * bytesPerPixel, yBoundary[testId]);
EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel,
width[testId], height[testId], stride));
delete[] buffer;
}
}
}
TEST(Gfx, BufferUnrotateVertical) {
const int NUM_OF_TESTS = 8;
int bytesPerPixelList[2] = {2,4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99};
int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99};
int xBoundary[NUM_OF_TESTS] = {0, 0, 0, 0};
int yBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31};
for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) {
int bytesPerPixel = bytesPerPixelList[bytesPerId];
int stride = 256 * bytesPerPixel;
for (int testId = 0; testId < NUM_OF_TESTS; testId++) {
unsigned char* buffer = GenerateBuffer(bytesPerPixel,
width[testId], height[testId], stride,
xBoundary[testId], yBoundary[testId]);
BufferUnrotate(buffer, width[testId] * bytesPerPixel,
height[testId], stride,
xBoundary[testId] * bytesPerPixel, yBoundary[testId]);
EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel,
width[testId], height[testId], stride));
delete[] buffer;
}
}
}
TEST(Gfx, BufferUnrotateBoth) {
const int NUM_OF_TESTS = 16;
int bytesPerPixelList[2] = {2,4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99, 100, 100, 99, 99, 100, 100, 99, 99};
int height[NUM_OF_TESTS] = {100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99, 100, 99};
int xBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 31, 31, 31, 31, 30, 30, 30, 30, 31, 31, 31, 31};
int yBoundary[NUM_OF_TESTS] = {30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31};
for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) {
int bytesPerPixel = bytesPerPixelList[bytesPerId];
int stride = 256 * bytesPerPixel;
for (int testId = 0; testId < NUM_OF_TESTS; testId++) {
unsigned char* buffer = GenerateBuffer(bytesPerPixel,
width[testId], height[testId], stride,
xBoundary[testId], yBoundary[testId]);
BufferUnrotate(buffer,
width[testId] * bytesPerPixel, height[testId], stride,
xBoundary[testId] * bytesPerPixel, yBoundary[testId]);
EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel,
width[testId], height[testId], stride));
delete[] buffer;
}
}
}
TEST(Gfx, BufferUnrotateUneven) {
const int NUM_OF_TESTS = 16;
int bytesPerPixelList[2] = {2,4};
int width[NUM_OF_TESTS] = {10, 100, 99, 39, 100, 40, 99, 39, 100, 50, 39, 99, 74, 60, 99, 39};
int height[NUM_OF_TESTS] = {100, 39, 10, 99, 10, 99, 40, 99, 73, 39, 100, 39, 67, 99, 84, 99};
int xBoundary[NUM_OF_TESTS] = {0, 0, 30, 30, 99, 31, 0, 31, 30, 30, 30, 30, 31, 31, 31, 38};
int yBoundary[NUM_OF_TESTS] = {30, 30, 0, 30, 0, 30, 0, 30, 31, 31, 31, 31, 31, 31, 31, 98};
for (int bytesPerId = 0; bytesPerId < 2; bytesPerId++) {
int bytesPerPixel = bytesPerPixelList[bytesPerId];
int stride = 256 * bytesPerPixel;
for (int testId = 0; testId < NUM_OF_TESTS; testId++) {
unsigned char* buffer = GenerateBuffer(bytesPerPixel,
width[testId], height[testId], stride,
xBoundary[testId], yBoundary[testId]);
BufferUnrotate(buffer,
width[testId]*bytesPerPixel, height[testId], stride,
xBoundary[testId]*bytesPerPixel, yBoundary[testId]);
EXPECT_TRUE(CheckBuffer(buffer, bytesPerPixel, width[testId], height[testId], stride));
delete[] buffer;
}
}
}

View File

@ -21,6 +21,7 @@ GTEST_CPP_SOURCES += [
'TestRegion.cpp',
'TestColorNames.cpp',
'TestTextures.cpp',
'TestBufferRotation.cpp',
]
# Because of gkmedia on windows we wont find these

View File

@ -5,7 +5,6 @@
#include "mozilla/Util.h"
#include "prtypes.h"
#include "prlink.h"
#include "gfxTypes.h"

View File

@ -51,7 +51,6 @@
#define GFX_SCRIPTITEMIZER_H
#include <stdint.h>
#include "prtypes.h"
#include "nsUnicodeScriptCodes.h"
#define PAREN_STACK_DEPTH 32

View File

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "prtypes.h"
#include "gfxTypes.h"
#include "gfxContext.h"

View File

@ -6,7 +6,6 @@
#ifndef GFX_UNISCRIBESHAPER_H
#define GFX_UNISCRIBESHAPER_H
#include "prtypes.h"
#include "gfxTypes.h"
#include "gfxGDIFont.h"

View File

@ -1,8 +0,0 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Decoders need RasterImage.h
LOCAL_INCLUDES += -I$(topsrcdir)/image/src/

View File

@ -45,3 +45,7 @@ CSRCS += [
'iccjpeg.c',
]
# Decoders need RasterImage.h
LOCAL_INCLUDES += [
'/image/src',
]

View File

@ -1,5 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
LOCAL_INCLUDES += -I$(topsrcdir)/image/src/

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