зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central to tracemonkey.
This commit is contained in:
Коммит
d957108dfc
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Filenames that should be ignored wherever they appear
|
||||
~$
|
||||
\.pyc$
|
||||
\.py(c|o)$
|
||||
(^|/)TAGS$
|
||||
(^|/)ID$
|
||||
(^|/)\.DS_Store$
|
||||
|
|
|
@ -925,10 +925,10 @@ refChildCB(AtkObject *aAtkObj, gint aChildIndex)
|
|||
NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
|
||||
if (!childAtkObj)
|
||||
return nsnull;
|
||||
g_object_ref(childAtkObj);
|
||||
|
||||
//this will addref parent
|
||||
atk_object_set_parent(childAtkObj, aAtkObj);
|
||||
g_object_ref(childAtkObj);
|
||||
return childAtkObj;
|
||||
}
|
||||
|
||||
|
|
|
@ -635,6 +635,24 @@ nsApplicationAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
struct AtkRootAccessibleAddedEvent {
|
||||
AtkObject *app_accessible;
|
||||
AtkObject *root_accessible;
|
||||
PRUint32 index;
|
||||
};
|
||||
|
||||
gboolean fireRootAccessibleAddedCB(gpointer data)
|
||||
{
|
||||
AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)data;
|
||||
g_signal_emit_by_name(eventData->app_accessible, "children_changed::add",
|
||||
eventData->index, eventData->root_accessible, NULL);
|
||||
g_object_unref(eventData->app_accessible);
|
||||
g_object_unref(eventData->root_accessible);
|
||||
free(data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
||||
{
|
||||
|
@ -648,20 +666,21 @@ nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
|
|||
atk_object_set_parent(atkAccessible, mAtkObject);
|
||||
|
||||
PRUint32 count = mChildren.Count();
|
||||
g_signal_emit_by_name(mAtkObject, "children_changed::add", count - 1,
|
||||
atkAccessible, NULL);
|
||||
|
||||
#ifdef MAI_LOGGING
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MAI_LOG_DEBUG(("\nAdd RootAcc=%p OK, count=%d\n",
|
||||
(void*)aRootAccWrap, count));
|
||||
// Emit children_changed::add in a timeout
|
||||
// to make sure aRootAccWrap is fully initialized.
|
||||
AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)
|
||||
malloc(sizeof(AtkRootAccessibleAddedEvent));
|
||||
if (eventData) {
|
||||
eventData->app_accessible = mAtkObject;
|
||||
eventData->root_accessible = atkAccessible;
|
||||
eventData->index = count -1;
|
||||
g_object_ref(mAtkObject);
|
||||
g_object_ref(atkAccessible);
|
||||
g_timeout_add(0, fireRootAccessibleAddedCB, eventData);
|
||||
}
|
||||
else
|
||||
MAI_LOG_DEBUG(("\nAdd RootAcc=%p Failed, count=%d\n",
|
||||
(void*)aRootAccWrap, count));
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -676,21 +695,7 @@ nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
|
|||
g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
|
||||
atkAccessible, NULL);
|
||||
|
||||
nsresult rv = nsApplicationAccessible::RemoveRootAccessible(aRootAccWrap);
|
||||
|
||||
#ifdef MAI_LOGGING
|
||||
PRUint32 count = mChildren.Count();
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MAI_LOG_DEBUG(("\nRemove RootAcc=%p, count=%d\n",
|
||||
(void*)aRootAccWrap, (count-1)));
|
||||
}
|
||||
else
|
||||
MAI_LOG_DEBUG(("\nFail to Remove RootAcc=%p, count=%d\n",
|
||||
(void*)aRootAccWrap, count));
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
return nsApplicationAccessible::RemoveRootAccessible(aRootAccWrap);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -705,16 +705,19 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
|
|||
{&nsAccessibilityAtoms::aria_haspopup, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_labelledby, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_level, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
||||
{&nsAccessibilityAtoms::aria_live, ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_owns, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_orientation, ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_posinset, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
||||
{&nsAccessibilityAtoms::aria_pressed, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_readonly, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_relevant, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_required, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_selected, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_setsize, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
||||
{&nsAccessibilityAtoms::aria_sort, ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_valuenow, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_valuemin, ATTR_BYPASSOBJ },
|
||||
|
|
|
@ -80,58 +80,10 @@ nsAccUtils::SetAccAttr(nsIPersistentProperties *aAttributes,
|
|||
aAttributes->SetStringProperty(attrName, aAttrValue, oldValue);
|
||||
}
|
||||
|
||||
void
|
||||
nsAccUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
|
||||
PRInt32 *aLevel, PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
*aLevel = 0;
|
||||
*aPosInSet = 0;
|
||||
*aSetSize = 0;
|
||||
|
||||
nsAutoString value;
|
||||
PRInt32 error = NS_OK;
|
||||
|
||||
GetAccAttr(aAttributes, nsAccessibilityAtoms::level, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 level = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aLevel = level;
|
||||
}
|
||||
|
||||
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 posInSet = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aPosInSet = posInSet;
|
||||
}
|
||||
|
||||
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 sizeSet = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aSetSize = sizeSet;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
|
||||
if (!value.IsEmpty()) {
|
||||
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
|
||||
return !value.IsEmpty();
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
|
||||
PRInt32 aLevel, PRInt32 aPosInSet,
|
||||
PRInt32 aSetSize)
|
||||
PRInt32 aLevel, PRInt32 aSetSize,
|
||||
PRInt32 aPosInSet)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
|
@ -152,8 +104,9 @@ nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
|
|||
}
|
||||
|
||||
void
|
||||
nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
nsIPersistentProperties *aAttributes)
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aNode));
|
||||
if (!item)
|
||||
|
@ -170,7 +123,9 @@ nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
|
|||
PRInt32 indexOf = 0;
|
||||
control->GetIndexOfItem(item, &indexOf);
|
||||
|
||||
PRUint32 setSize = itemsCount, posInSet = indexOf;
|
||||
*aSetSize = itemsCount;
|
||||
*aPosInSet = indexOf;
|
||||
|
||||
for (PRUint32 index = 0; index < itemsCount; index++) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> currItem;
|
||||
control->GetItemAtIndex(index, getter_AddRefs(currItem));
|
||||
|
@ -181,18 +136,19 @@ nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
|
|||
getter_AddRefs(itemAcc));
|
||||
if (!itemAcc ||
|
||||
State(itemAcc) & nsIAccessibleStates::STATE_INVISIBLE) {
|
||||
setSize--;
|
||||
(*aSetSize)--;
|
||||
if (index < static_cast<PRUint32>(indexOf))
|
||||
posInSet--;
|
||||
(*aPosInSet)--;
|
||||
}
|
||||
}
|
||||
|
||||
SetAccGroupAttrs(aAttributes, 0, posInSet + 1, setSize);
|
||||
(*aPosInSet)++; // group position is 1-index based.
|
||||
}
|
||||
|
||||
void
|
||||
nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
||||
nsIPersistentProperties *aAttributes)
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aNode));
|
||||
if (!item)
|
||||
|
@ -212,7 +168,7 @@ nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
|||
container->GetIndexOfItem(item, &indexOf);
|
||||
|
||||
// Calculate set size and position in the set.
|
||||
PRUint32 setSize = 0, posInSet = 0;
|
||||
*aSetSize = 0, *aPosInSet = 0;
|
||||
for (PRInt32 index = indexOf; index >= 0; index--) {
|
||||
nsCOMPtr<nsIDOMXULElement> item;
|
||||
container->GetItemAtIndex(index, getter_AddRefs(item));
|
||||
|
@ -228,8 +184,8 @@ nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
|||
|
||||
PRUint32 itemState = State(itemAcc);
|
||||
if (!(itemState & nsIAccessibleStates::STATE_INVISIBLE)) {
|
||||
setSize++;
|
||||
posInSet++;
|
||||
(*aSetSize)++;
|
||||
(*aPosInSet)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,9 +206,22 @@ nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
|||
|
||||
PRUint32 itemState = State(itemAcc);
|
||||
if (!(itemState & nsIAccessibleStates::STATE_INVISIBLE))
|
||||
setSize++;
|
||||
(*aSetSize)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccUtils::GetLevelForXULContainerItem(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aNode));
|
||||
if (!item)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIDOMXULContainerElement> container;
|
||||
item->GetParentContainer(getter_AddRefs(container));
|
||||
if (!container)
|
||||
return 0;
|
||||
|
||||
// Get level of the item.
|
||||
PRInt32 level = -1;
|
||||
|
@ -263,8 +232,8 @@ nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
|||
container->GetParentContainer(getter_AddRefs(parentContainer));
|
||||
parentContainer.swap(container);
|
||||
}
|
||||
|
||||
SetAccGroupAttrs(aAttributes, level, posInSet, setSize);
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -85,46 +85,33 @@ public:
|
|||
nsIAtom *aAttrName,
|
||||
const nsAString& aAttrValue);
|
||||
|
||||
/**
|
||||
* Return values of group attributes ('level', 'setsize', 'posinset')
|
||||
*/
|
||||
static void GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
|
||||
PRInt32 *aLevel,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Returns true if there are level, posinset and sizeset attributes.
|
||||
*/
|
||||
static PRBool HasAccGroupAttrs(nsIPersistentProperties *aAttributes);
|
||||
|
||||
/**
|
||||
* Set group attributes ('level', 'setsize', 'posinset').
|
||||
*/
|
||||
static void SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
|
||||
PRInt32 aLevel,
|
||||
PRInt32 aPosInSet,
|
||||
PRInt32 aSetSize);
|
||||
PRInt32 aLevel, PRInt32 aSetSize,
|
||||
PRInt32 aPosInSet);
|
||||
|
||||
/**
|
||||
* Set group attributes - 'level', 'setsize', 'posinset'.
|
||||
*
|
||||
* @param aNode - XUL element that implements
|
||||
* nsIDOMXULSelectControlItemElement interface
|
||||
* @param aAttributes - attributes container
|
||||
* Compute position in group (posinset) and group size (setsize) for
|
||||
* nsIDOMXULSelectControlItemElement node.
|
||||
*/
|
||||
static void SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
nsIPersistentProperties *aAttributes);
|
||||
static void GetPositionAndSizeForXULSelectControlItem(nsIDOMNode *aNode,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Set group attributes - 'level', 'setsize', 'posinset'.
|
||||
*
|
||||
* @param aNode XUL element that implements
|
||||
* nsIDOMXULContainerItemElement interface
|
||||
* @param aAttributes attributes container
|
||||
* Compute group position and group size (posinset and setsize) for
|
||||
* nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
static void SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
|
||||
nsIPersistentProperties *aAttributes);
|
||||
static void GetPositionAndSizeForXULContainerItem(nsIDOMNode *aNode,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Compute group level for nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
static PRInt32 GetLevelForXULContainerItem(nsIDOMNode *aNode);
|
||||
|
||||
/**
|
||||
* Set container-foo live region attributes for the given node.
|
||||
|
|
|
@ -1506,13 +1506,10 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
|||
nsAccUtils::SetAccAttr(attributes, nsAccessibilityAtoms::checkable, NS_LITERAL_STRING("true"));
|
||||
|
||||
// Group attributes (level/setsize/posinset)
|
||||
if (!nsAccUtils::HasAccGroupAttrs(attributes)) {
|
||||
// Calculate group attributes based on accessible hierarhy if they weren't
|
||||
// provided by ARIA or by accessible class implementation.
|
||||
PRUint32 role = nsAccUtils::Role(this);
|
||||
rv = ComputeGroupAttributes(role, attributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
PRInt32 level = 0, posInSet = 0, setSize = 0;
|
||||
rv = GroupPosition(&level, &setSize, &posInSet);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsAccUtils::SetAccGroupAttrs(attributes, level, setSize, posInSet);
|
||||
|
||||
// Expose object attributes from ARIA attributes.
|
||||
PRUint32 numAttrs = content->GetAttrCount();
|
||||
|
@ -1655,37 +1652,71 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
|||
PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup)
|
||||
{
|
||||
// Every element exposes level/posinset/sizeset for IAccessdible::attributes
|
||||
// if they make sense for it. These attributes are mapped into groupPosition.
|
||||
// If 'level' attribute doesn't make sense element then it isn't represented
|
||||
// via IAccessible::attributes and groupLevel of groupPosition method is 0.
|
||||
// Elements that expose 'level' attribute only (like html headings elements)
|
||||
// don't support this method and all arguments are equalled 0.
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aGroupLevel);
|
||||
NS_ENSURE_ARG_POINTER(aSimilarItemsInGroup);
|
||||
NS_ENSURE_ARG_POINTER(aPositionInGroup);
|
||||
|
||||
*aGroupLevel = 0;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aSimilarItemsInGroup);
|
||||
*aSimilarItemsInGroup = 0;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aPositionInGroup);
|
||||
*aPositionInGroup = 0;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(attributes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!attributes) {
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRInt32 level, posInSet, setSize;
|
||||
nsAccUtils::GetAccGroupAttrs(attributes, &level, &posInSet, &setSize);
|
||||
|
||||
if (!posInSet && !setSize)
|
||||
// Get group position from ARIA attributes.
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
*aGroupLevel = level;
|
||||
nsAutoString value;
|
||||
PRInt32 error = NS_OK;
|
||||
|
||||
*aPositionInGroup = posInSet;
|
||||
*aSimilarItemsInGroup = setSize;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_level, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 level = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aGroupLevel = level;
|
||||
}
|
||||
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_posinset, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 posInSet = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aPositionInGroup = posInSet;
|
||||
}
|
||||
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_setsize, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 sizeSet = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aSimilarItemsInGroup = sizeSet;
|
||||
}
|
||||
|
||||
// If ARIA is missed and the accessible is visible then calculate group
|
||||
// position from hierarchy.
|
||||
if (nsAccUtils::State(this) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
return NS_OK;
|
||||
|
||||
// Calculate group level if ARIA is missed.
|
||||
if (*aGroupLevel == 0) {
|
||||
PRInt32 level = GetLevelInternal();
|
||||
if (level != 0)
|
||||
*aGroupLevel = level;
|
||||
}
|
||||
|
||||
// Calculate position in group and group size if ARIA is missed.
|
||||
if (*aSimilarItemsInGroup == 0 || *aPositionInGroup == 0) {
|
||||
PRInt32 posInSet = 0, setSize = 0;
|
||||
GetPositionAndSizeInternal(&posInSet, &setSize);
|
||||
if (posInSet != 0 && setSize != 0) {
|
||||
if (*aPositionInGroup == 0)
|
||||
*aPositionInGroup = posInSet;
|
||||
|
||||
if (*aSimilarItemsInGroup == 0)
|
||||
*aSimilarItemsInGroup = setSize;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3291,40 +3322,29 @@ nsAccessible::GetActionRule(PRUint32 aStates)
|
|||
return eNoAction;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessible::ComputeGroupAttributes(PRUint32 aRole,
|
||||
nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet, PRInt32 *aSetSize)
|
||||
{
|
||||
// The role of an accessible can be specified by ARIA attribute but ARIA
|
||||
// posinset, level, setsize may be skipped. As well this method is used
|
||||
// for non ARIA accessibles to avoid GetAccessibleInternal() method
|
||||
// implementation in subclasses. For example, it's being used to calculate
|
||||
// group attributes for HTML li elements.
|
||||
PRUint32 role = nsAccUtils::Role(this);
|
||||
if (role != nsIAccessibleRole::ROLE_LISTITEM &&
|
||||
role != nsIAccessibleRole::ROLE_MENUITEM &&
|
||||
role != nsIAccessibleRole::ROLE_CHECK_MENU_ITEM &&
|
||||
role != nsIAccessibleRole::ROLE_RADIO_MENU_ITEM &&
|
||||
role != nsIAccessibleRole::ROLE_RADIOBUTTON &&
|
||||
role != nsIAccessibleRole::ROLE_PAGETAB &&
|
||||
role != nsIAccessibleRole::ROLE_OPTION &&
|
||||
role != nsIAccessibleRole::ROLE_OUTLINEITEM &&
|
||||
role != nsIAccessibleRole::ROLE_ROW &&
|
||||
role != nsIAccessibleRole::ROLE_GRID_CELL)
|
||||
return;
|
||||
|
||||
// If accessible is invisible we don't want to calculate group attributes for
|
||||
// it.
|
||||
if (nsAccUtils::State(this) & nsIAccessibleStates::STATE_INVISIBLE)
|
||||
return NS_OK;
|
||||
|
||||
if (aRole != nsIAccessibleRole::ROLE_LISTITEM &&
|
||||
aRole != nsIAccessibleRole::ROLE_MENUITEM &&
|
||||
aRole != nsIAccessibleRole::ROLE_CHECK_MENU_ITEM &&
|
||||
aRole != nsIAccessibleRole::ROLE_RADIO_MENU_ITEM &&
|
||||
aRole != nsIAccessibleRole::ROLE_RADIOBUTTON &&
|
||||
aRole != nsIAccessibleRole::ROLE_PAGETAB &&
|
||||
aRole != nsIAccessibleRole::ROLE_OPTION &&
|
||||
aRole != nsIAccessibleRole::ROLE_OUTLINEITEM &&
|
||||
aRole != nsIAccessibleRole::ROLE_ROW &&
|
||||
aRole != nsIAccessibleRole::ROLE_GRID_CELL)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 baseRole = aRole;
|
||||
if (aRole == nsIAccessibleRole::ROLE_CHECK_MENU_ITEM ||
|
||||
aRole == nsIAccessibleRole::ROLE_RADIO_MENU_ITEM)
|
||||
PRUint32 baseRole = role;
|
||||
if (role == nsIAccessibleRole::ROLE_CHECK_MENU_ITEM ||
|
||||
role == nsIAccessibleRole::ROLE_RADIO_MENU_ITEM)
|
||||
baseRole = nsIAccessibleRole::ROLE_MENUITEM;
|
||||
|
||||
nsCOMPtr<nsIAccessible> parent = GetParent();
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(parent,);
|
||||
|
||||
// Compute 'posinset' and 'setsize' attributes.
|
||||
PRInt32 positionInGroup = 0;
|
||||
|
@ -3332,7 +3352,7 @@ nsAccessible::ComputeGroupAttributes(PRUint32 aRole,
|
|||
|
||||
nsCOMPtr<nsIAccessible> sibling, nextSibling;
|
||||
parent->GetFirstChild(getter_AddRefs(sibling));
|
||||
NS_ENSURE_STATE(sibling);
|
||||
NS_ENSURE_TRUE(sibling,);
|
||||
|
||||
PRBool foundCurrent = PR_FALSE;
|
||||
PRUint32 siblingRole, siblingBaseRole;
|
||||
|
@ -3369,13 +3389,21 @@ nsAccessible::ComputeGroupAttributes(PRUint32 aRole,
|
|||
sibling = nextSibling;
|
||||
}
|
||||
|
||||
// Compute 'level' attribute.
|
||||
PRInt32 groupLevel = 0;
|
||||
if (aRole == nsIAccessibleRole::ROLE_OUTLINEITEM) {
|
||||
*aPosInSet = positionInGroup;
|
||||
*aSetSize = setSize;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessible::GetLevelInternal()
|
||||
{
|
||||
PRUint32 role = nsAccUtils::Role(this);
|
||||
nsCOMPtr<nsIAccessible> parent = GetParent();
|
||||
|
||||
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
|
||||
// Always expose 'level' attribute for 'outlineitem' accessible. The number
|
||||
// of nested 'grouping' accessibles containing 'outlineitem' accessible is
|
||||
// its level.
|
||||
groupLevel = 1;
|
||||
PRInt32 level = 1;
|
||||
nsCOMPtr<nsIAccessible> nextParent;
|
||||
while (parent) {
|
||||
PRUint32 parentRole = nsAccUtils::Role(parent);
|
||||
|
@ -3383,24 +3411,30 @@ nsAccessible::ComputeGroupAttributes(PRUint32 aRole,
|
|||
if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
|
||||
break;
|
||||
if (parentRole == nsIAccessibleRole::ROLE_GROUPING)
|
||||
++ groupLevel;
|
||||
++ level;
|
||||
|
||||
parent->GetParent(getter_AddRefs(nextParent));
|
||||
parent.swap(nextParent);
|
||||
}
|
||||
} else if (aRole == nsIAccessibleRole::ROLE_LISTITEM) {
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
if (role == nsIAccessibleRole::ROLE_LISTITEM) {
|
||||
// Expose 'level' attribute on nested lists. We assume nested list is a last
|
||||
// child of listitem of parent list. We don't handle the case when nested
|
||||
// lists have more complex structure, for example when there are accessibles
|
||||
// between parent listitem and nested list.
|
||||
|
||||
// Calculate 'level' attribute based on number of parent listitems.
|
||||
PRInt32 level = 0;
|
||||
nsCOMPtr<nsIAccessible> nextParent;
|
||||
|
||||
while (parent) {
|
||||
PRUint32 parentRole = nsAccUtils::Role(parent);
|
||||
|
||||
if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
|
||||
++ groupLevel;
|
||||
++ level;
|
||||
else if (parentRole != nsIAccessibleRole::ROLE_LIST)
|
||||
break;
|
||||
|
||||
|
@ -3408,35 +3442,36 @@ nsAccessible::ComputeGroupAttributes(PRUint32 aRole,
|
|||
parent.swap(nextParent);
|
||||
}
|
||||
|
||||
if (groupLevel == 0) {
|
||||
if (level == 0) {
|
||||
// If this listitem is on top of nested lists then expose 'level'
|
||||
// attribute.
|
||||
nsCOMPtr<nsIAccessible> parent = GetParent();
|
||||
nsCOMPtr<nsIAccessible> parent(GetParent()), sibling, nextSibling;
|
||||
parent->GetFirstChild(getter_AddRefs(sibling));
|
||||
|
||||
while (sibling) {
|
||||
nsCOMPtr<nsIAccessible> siblingChild;
|
||||
sibling->GetLastChild(getter_AddRefs(siblingChild));
|
||||
if (nsAccUtils::Role(siblingChild) == nsIAccessibleRole::ROLE_LIST) {
|
||||
groupLevel = 1;
|
||||
level = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
sibling->GetNextSibling(getter_AddRefs(nextSibling));
|
||||
sibling.swap(nextSibling);
|
||||
}
|
||||
} else
|
||||
groupLevel++; // level is 1-index based
|
||||
} else {
|
||||
++ level; // level is 1-index based
|
||||
}
|
||||
|
||||
} else if (aRole == nsIAccessibleRole::ROLE_ROW &&
|
||||
nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE) {
|
||||
// It is a row inside flatten treegrid. Group level is always 1 until it is
|
||||
// overriden by aria-level attribute.
|
||||
groupLevel = 1;
|
||||
return level;
|
||||
}
|
||||
|
||||
nsAccUtils::SetAccGroupAttrs(aAttributes, groupLevel, positionInGroup,
|
||||
setSize);
|
||||
if (role == nsIAccessibleRole::ROLE_ROW &&
|
||||
nsAccUtils::Role(parent) == nsIAccessibleRole::ROLE_TREE_TABLE) {
|
||||
// It is a row inside flatten treegrid. Group level is always 1 until it is
|
||||
// overriden by aria-level attribute.
|
||||
return 1;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -103,11 +103,11 @@ private:
|
|||
|
||||
|
||||
#define NS_ACCESSIBLE_IMPL_CID \
|
||||
{ /* 07c5a6d6-4e87-4b57-8613-4c39e1b5150a */ \
|
||||
0x07c5a6d6, \
|
||||
0x4e87, \
|
||||
0x4b57, \
|
||||
{ 0x86, 0x13, 0x4c, 0x39, 0xe1, 0xb5, 0x15, 0x0a } \
|
||||
{ /* 81a84b69-de5a-412f-85ff-deb005c5a68d */ \
|
||||
0x81a84b69, \
|
||||
0xde5a, \
|
||||
0x412f, \
|
||||
{ 0x85, 0xff, 0xde, 0xb0, 0x05, 0xc5, 0xa6, 0x8d } \
|
||||
}
|
||||
|
||||
class nsAccessible : public nsAccessNodeWrap,
|
||||
|
@ -198,6 +198,21 @@ public:
|
|||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
|
||||
/**
|
||||
* Return calculated group level based on accessible hierarchy.
|
||||
*/
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
|
||||
/**
|
||||
* Calculate position in group and group size ('posinset' and 'setsize') based
|
||||
* on accessible hierarchy.
|
||||
*
|
||||
* @param aPosInSet [out] accessible position in the group
|
||||
* @param aSetSize [out] the group size
|
||||
*/
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializing methods
|
||||
|
||||
|
@ -428,17 +443,6 @@ protected:
|
|||
*/
|
||||
PRUint32 GetActionRule(PRUint32 aStates);
|
||||
|
||||
/**
|
||||
* Compute group attributes ('posinset', 'setsize' and 'level') based
|
||||
* on accessible hierarchy. Used by GetAttributes() method if group attributes
|
||||
* weren't provided by ARIA or by internal accessible implementation.
|
||||
*
|
||||
* @param aRole [in] role of this accessible
|
||||
* @param aAttributes [in, out] object attributes
|
||||
*/
|
||||
nsresult ComputeGroupAttributes(PRUint32 aRole,
|
||||
nsIPersistentProperties *aAttributes);
|
||||
|
||||
/**
|
||||
* Fires platform accessible event. It's notification method only. It does
|
||||
* change nothing on Gecko side. Mostly you should use
|
||||
|
|
|
@ -141,7 +141,9 @@ nsHTMLCheckboxAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//------ Radio button -------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLRadioButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRadioButtonAccessible(aNode, aShell)
|
||||
|
@ -169,22 +171,16 @@ nsHTMLRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsRadioButtonAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString nsURI;
|
||||
mDOMNode->GetNamespaceURI(nsURI);
|
||||
nsAutoString tagName;
|
||||
mDOMNode->GetLocalName(tagName);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
nsAutoString type;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::type, type);
|
||||
|
@ -205,12 +201,12 @@ nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
|
|||
document->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(inputs, NS_OK);
|
||||
NS_ENSURE_TRUE(inputs, );
|
||||
|
||||
PRUint32 inputsCount = 0;
|
||||
inputs->GetLength(&inputsCount);
|
||||
|
||||
// Get posinset and setsize.
|
||||
// Compute posinset and setsize.
|
||||
PRInt32 indexOf = 0;
|
||||
PRInt32 count = 0;
|
||||
|
||||
|
@ -232,12 +228,13 @@ nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
|
|||
}
|
||||
}
|
||||
|
||||
nsAccUtils::SetAccGroupAttrs(aAttributes, 0, indexOf, count);
|
||||
|
||||
return NS_OK;
|
||||
*aPosInSet = indexOf;
|
||||
*aSetSize = count;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessibleWrap(aNode, aShell)
|
||||
|
|
|
@ -67,8 +67,9 @@ public:
|
|||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap
|
||||
|
|
|
@ -448,7 +448,9 @@ nsHyperTextAccessibleWrap(aDOMNode, aShell)
|
|||
SetParent(parentAccessible);
|
||||
}
|
||||
|
||||
/** We are a ListItem */
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: nsAccessible public
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectOptionAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
|
@ -491,49 +493,6 @@ nsHTMLSelectOptionAccessible::GetNameInternal(nsAString& aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
if (!mDOMNode) {
|
||||
return NS_ERROR_FAILURE; // Accessible shut down
|
||||
}
|
||||
|
||||
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
nsCOMPtr<nsIDOMElement> parentElement(do_QueryInterface(parentNode));
|
||||
NS_ENSURE_TRUE(parentElement, NS_ERROR_FAILURE);
|
||||
nsAutoString parentTagName;
|
||||
parentNode->GetLocalName(parentTagName);
|
||||
|
||||
PRInt32 level = parentTagName.LowerCaseEqualsLiteral("optgroup") ? 2 : 1;
|
||||
if (level == 1 && nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_HEADING) {
|
||||
level = 0; // In a single level list, the level is irrelevant
|
||||
}
|
||||
|
||||
nsAutoString tagName;
|
||||
mDOMNode->GetLocalName(tagName); // Will be looking for similar DOM siblings
|
||||
nsCOMPtr<nsIDOMNodeList> siblings;
|
||||
parentElement->GetElementsByTagName(tagName, getter_AddRefs(siblings));
|
||||
PRInt32 posInSet = 0;
|
||||
PRUint32 setSize = 0;
|
||||
if (siblings) {
|
||||
siblings->GetLength(&setSize);
|
||||
nsCOMPtr<nsIDOMNode> itemNode;
|
||||
while (NS_SUCCEEDED(siblings->Item(posInSet ++, getter_AddRefs(itemNode))) &&
|
||||
itemNode != mDOMNode) {
|
||||
// Keep looping, to increment posInSet
|
||||
}
|
||||
}
|
||||
|
||||
nsAccUtils::SetAccGroupAttrs(aAttributes, level, posInSet,
|
||||
static_cast<PRInt32>(setSize));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
||||
{
|
||||
PRUint32 state;
|
||||
|
@ -641,6 +600,54 @@ nsHTMLSelectOptionAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHTMLSelectOptionAccessible::GetLevelInternal()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIContent *parentContent = content->GetParent();
|
||||
|
||||
PRInt32 level =
|
||||
parentContent->NodeInfo()->Equals(nsAccessibilityAtoms::optgroup) ? 2 : 1;
|
||||
|
||||
if (level == 1 &&
|
||||
nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_HEADING) {
|
||||
level = 0; // In a single level list, the level is irrelevant
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIContent *parentContent = content->GetParent();
|
||||
|
||||
PRInt32 posInSet = 0, setSize = 0;
|
||||
PRBool isContentFound = PR_FALSE;
|
||||
|
||||
PRUint32 childCount = parentContent->GetChildCount();
|
||||
for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsIContent *childContent = parentContent->GetChildAt(childIdx);
|
||||
if (childContent->NodeInfo()->Equals(content->NodeInfo())) {
|
||||
if (!isContentFound) {
|
||||
if (childContent == content)
|
||||
isContentFound = PR_TRUE;
|
||||
|
||||
posInSet++;
|
||||
}
|
||||
setSize++;
|
||||
}
|
||||
}
|
||||
|
||||
*aSetSize = setSize;
|
||||
*aPosInSet = posInSet;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: nsIAccessible
|
||||
|
||||
/** select us! close combo box if necessary*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
|
@ -715,6 +722,9 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: static methods
|
||||
|
||||
/**
|
||||
* Helper method for getting the focused DOM Node from our parent(list) node. We
|
||||
* need to use the frame to get the focused option because for some reason we
|
||||
|
@ -813,6 +823,9 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
|
|||
nsAccUtils::FireAccEvent(eventType, optionAccessible);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: private methods
|
||||
|
||||
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
|
||||
PRUint32* aExtraState)
|
||||
{
|
||||
|
|
|
@ -162,7 +162,10 @@ public:
|
|||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
nsIFrame* GetBoundsFrame();
|
||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
|
||||
|
|
|
@ -1194,41 +1194,35 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
|
|||
return textAttrsMgr.GetAttributes(*aAttributes);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsHyperTextAccessible::GetLevelInternal()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, 0);
|
||||
|
||||
nsIAtom *tag = content->Tag();
|
||||
if (tag == nsAccessibilityAtoms::h1)
|
||||
return 1;
|
||||
if (tag == nsAccessibilityAtoms::h2)
|
||||
return 2;
|
||||
if (tag == nsAccessibilityAtoms::h3)
|
||||
return 3;
|
||||
if (tag == nsAccessibilityAtoms::h4)
|
||||
return 4;
|
||||
if (tag == nsAccessibilityAtoms::h5)
|
||||
return 5;
|
||||
if (tag == nsAccessibilityAtoms::h6)
|
||||
return 6;
|
||||
|
||||
return nsAccessibleWrap::GetLevelInternal();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
{
|
||||
if (!mDOMNode) {
|
||||
return NS_ERROR_FAILURE; // Node already shut down
|
||||
}
|
||||
|
||||
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
|
||||
nsIAtom *tag = content->Tag();
|
||||
|
||||
PRInt32 headLevel = 0;
|
||||
if (tag == nsAccessibilityAtoms::h1)
|
||||
headLevel = 1;
|
||||
else if (tag == nsAccessibilityAtoms::h2)
|
||||
headLevel = 2;
|
||||
else if (tag == nsAccessibilityAtoms::h3)
|
||||
headLevel = 3;
|
||||
else if (tag == nsAccessibilityAtoms::h4)
|
||||
headLevel = 4;
|
||||
else if (tag == nsAccessibilityAtoms::h5)
|
||||
headLevel = 5;
|
||||
else if (tag == nsAccessibilityAtoms::h6)
|
||||
headLevel = 6;
|
||||
|
||||
if (headLevel) {
|
||||
nsAutoString strHeadLevel;
|
||||
strHeadLevel.AppendInt(headLevel);
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::level,
|
||||
strHeadLevel);
|
||||
}
|
||||
|
||||
// Indicate when the current object uses block-level formatting
|
||||
// via formatting: block
|
||||
// XXX: 'formatting' attribute is deprecated and will be removed in Mozilla2,
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
|
||||
|
||||
// nsAccessible
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
|
|
@ -85,7 +85,7 @@ static const PRInt32 kIEnumVariantDisconnected = -1;
|
|||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference *aShell):
|
||||
nsAccessible(aNode, aShell), mEnumVARIANTPosition(0)
|
||||
nsAccessible(aNode, aShell), mEnumVARIANTPosition(0), mTypeInfo(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -94,6 +94,8 @@ nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference *aShell):
|
|||
//-----------------------------------------------------
|
||||
nsAccessibleWrap::~nsAccessibleWrap()
|
||||
{
|
||||
if (mTypeInfo)
|
||||
mTypeInfo->Release();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAccessibleWrap, nsAccessible);
|
||||
|
@ -370,20 +372,11 @@ __try {
|
|||
|
||||
nsAutoString description;
|
||||
|
||||
// Try to get group attributes to make a positional description string. We
|
||||
// can't use nsIAccessible::groupPosition because the method isn't supposed
|
||||
// to work with elements exposing 'level' attribute only (like HTML headings).
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = xpAccessible->GetAttributes(getter_AddRefs(attributes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!attributes)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Try to get group position to make a positional description string.
|
||||
PRInt32 groupLevel = 0;
|
||||
PRInt32 itemsInGroup = 0;
|
||||
PRInt32 positionInGroup = 0;
|
||||
nsAccUtils::GetAccGroupAttrs(attributes, &groupLevel, &positionInGroup,
|
||||
&itemsInGroup);
|
||||
GroupPosition(&groupLevel, &itemsInGroup, &positionInGroup);
|
||||
|
||||
if (positionInGroup > 0) {
|
||||
if (groupLevel > 0) {
|
||||
|
@ -1340,18 +1333,22 @@ __try {
|
|||
PRInt32 groupLevel = 0;
|
||||
PRInt32 similarItemsInGroup = 0;
|
||||
PRInt32 positionInGroup = 0;
|
||||
|
||||
nsresult rv = GroupPosition(&groupLevel, &similarItemsInGroup,
|
||||
&positionInGroup);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
// Group information for accessibles having level only (like html headings
|
||||
// elements) isn't exposed by this method. AT should look for 'level' object
|
||||
// attribute.
|
||||
if (!similarItemsInGroup && !positionInGroup)
|
||||
return S_FALSE;
|
||||
|
||||
*aGroupLevel = groupLevel;
|
||||
*aSimilarItemsInGroup = similarItemsInGroup;
|
||||
*aPositionInGroup = positionInGroup;
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (groupLevel ==0 && similarItemsInGroup == 0 && positionInGroup == 0)
|
||||
return S_FALSE;
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -1594,38 +1591,63 @@ __try {
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
// For IDispatch support
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IDispatch
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::GetTypeInfoCount(UINT *p)
|
||||
nsAccessibleWrap::GetTypeInfoCount(UINT *pctinfo)
|
||||
{
|
||||
*p = 0;
|
||||
return E_NOTIMPL;
|
||||
*pctinfo = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// For IDispatch support
|
||||
STDMETHODIMP nsAccessibleWrap::GetTypeInfo(UINT i, LCID lcid, ITypeInfo **ppti)
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
*ppti = 0;
|
||||
return E_NOTIMPL;
|
||||
*ppTInfo = NULL;
|
||||
|
||||
if (iTInfo != 0)
|
||||
return ResultFromScode(DISP_E_BADINDEX);
|
||||
|
||||
ITypeInfo * typeInfo = GetTI(lcid);
|
||||
if (!typeInfo)
|
||||
return E_FAIL;
|
||||
|
||||
typeInfo->AddRef();
|
||||
*ppTInfo = typeInfo;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// For IDispatch support
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID *rgDispId)
|
||||
UINT cNames, LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
ITypeInfo *typeInfo = GetTI(lcid);
|
||||
if (!typeInfo)
|
||||
return E_FAIL;
|
||||
|
||||
HRESULT hr = DispGetIDsOfNames(typeInfo, rgszNames, cNames, rgDispId);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// For IDispatch support
|
||||
STDMETHODIMP nsAccessibleWrap::Invoke(DISPID dispIdMember, REFIID riid,
|
||||
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::Invoke(DISPID dispIdMember, REFIID riid,
|
||||
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
||||
UINT *puArgErr)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
ITypeInfo *typeInfo = GetTI(lcid);
|
||||
if (!typeInfo)
|
||||
return E_FAIL;
|
||||
|
||||
return typeInfo->Invoke(static_cast<IAccessible*>(this), dispIdMember,
|
||||
wFlags, pDispParams, pVarResult, pExcepInfo,
|
||||
puArgErr);
|
||||
}
|
||||
|
||||
|
||||
// nsIAccessible method
|
||||
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
||||
{
|
||||
*aOutAccessible = static_cast<IAccessible*>(this);
|
||||
|
@ -1940,3 +1962,23 @@ void nsAccessibleWrap::UpdateSystemCaret()
|
|||
::DeleteObject(caretBitMap);
|
||||
}
|
||||
}
|
||||
|
||||
ITypeInfo*
|
||||
nsAccessibleWrap::GetTI(LCID lcid)
|
||||
{
|
||||
if (mTypeInfo)
|
||||
return mTypeInfo;
|
||||
|
||||
ITypeLib *typeLib = NULL;
|
||||
HRESULT hr = LoadRegTypeLib(LIBID_Accessibility, 1, 0, lcid, &typeLib);
|
||||
if (FAILED(hr))
|
||||
return NULL;
|
||||
|
||||
hr = typeLib->GetTypeInfoOfGuid(IID_IAccessible, &mTypeInfo);
|
||||
typeLib->Release();
|
||||
|
||||
if (FAILED(hr))
|
||||
return NULL;
|
||||
|
||||
return mTypeInfo;
|
||||
}
|
||||
|
|
|
@ -287,15 +287,24 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
/* [out] */ IEnumVARIANT __RPC_FAR *__RPC_FAR *ppEnum);
|
||||
|
||||
|
||||
// ====== Methods for IDispatch - for VisualBasic bindings (not implemented) ======
|
||||
// IDispatch (support of scripting languages like VB)
|
||||
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
|
||||
|
||||
STDMETHODIMP GetTypeInfoCount(UINT *p);
|
||||
STDMETHODIMP GetTypeInfo(UINT i, LCID lcid, ITypeInfo **ppti);
|
||||
STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
|
||||
UINT cNames, LCID lcid, DISPID *rgDispId);
|
||||
STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid,
|
||||
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid,
|
||||
ITypeInfo **ppTInfo);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid,
|
||||
LPOLESTR *rgszNames,
|
||||
UINT cNames,
|
||||
LCID lcid,
|
||||
DISPID *rgDispId);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid,
|
||||
LCID lcid, WORD wFlags,
|
||||
DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult,
|
||||
EXCEPINFO *pExcepInfo,
|
||||
UINT *puArgErr);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
@ -340,6 +349,14 @@ protected:
|
|||
// nsIEnumVariant::Reset(), Skip() and Next().
|
||||
PRInt32 mEnumVARIANTPosition;
|
||||
|
||||
/**
|
||||
* Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
|
||||
*/
|
||||
ITypeInfo *GetTI(LCID lcid);
|
||||
|
||||
ITypeInfo *mTypeInfo;
|
||||
|
||||
|
||||
enum navRelations {
|
||||
NAVRELATION_CONTROLLED_BY = 0x1000,
|
||||
NAVRELATION_CONTROLLER_FOR = 0x1001,
|
||||
|
|
|
@ -659,9 +659,9 @@ nsXULProgressMeterAccessible::SetCurrentValue(double aValue)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* XUL Radio Button
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** Constructor */
|
||||
nsXULRadioButtonAccessible::nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
|
@ -692,20 +692,19 @@ nsXULRadioButtonAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsXULRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsFormControlAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
|
||||
|
||||
return NS_OK;
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mDOMNode, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioGroupAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* XUL Radio Group
|
||||
* The Radio Group proxies for the Radio Buttons themselves. The Group gets
|
||||
|
@ -773,15 +772,10 @@ nsXULButtonAccessible(aNode, aShell)
|
|||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULToolbarButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsXULButtonAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessible> parent(GetParent());
|
||||
PRInt32 setSize = 0;
|
||||
PRInt32 posInSet = 0;
|
||||
|
@ -804,10 +798,9 @@ nsXULToolbarButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
|
|||
sibling.swap(tempSibling);
|
||||
}
|
||||
}
|
||||
|
||||
nsAccUtils::SetAccGroupAttrs(aAttributes, 0, posInSet, setSize);
|
||||
|
||||
return NS_OK;
|
||||
*aPosInSet = posInSet;
|
||||
*aSetSize = setSize;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -148,6 +148,9 @@ public:
|
|||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for XUL radio button (xul:radio).
|
||||
*/
|
||||
class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
|
||||
{
|
||||
|
||||
|
@ -155,8 +158,9 @@ public:
|
|||
nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
};
|
||||
|
||||
class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
|
||||
|
@ -182,7 +186,11 @@ class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
|
|||
{
|
||||
public:
|
||||
nsXULToolbarButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
// nsAccessible
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
static PRBool IsSeparator(nsIAccessible *aAccessible);
|
||||
};
|
||||
|
||||
|
|
|
@ -1009,19 +1009,12 @@ nsXULListitemAccessible::GetAllowsAnonChildAccessibles()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULListitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsXULListitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
|
||||
// Call base class instead of nsXULMenuAccessible because menu accessible
|
||||
// has own implementation of group attributes setting which interferes with
|
||||
// this one.
|
||||
nsresult rv = nsAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
|
||||
return NS_OK;
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mDOMNode, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -129,7 +129,8 @@ public:
|
|||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -502,17 +502,18 @@ nsXULMenuitemAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULMenuitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
PRInt32
|
||||
nsXULMenuitemAccessible::GetLevelInternal()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
return nsAccUtils::GetLevelForXULContainerItem(mDOMNode);
|
||||
}
|
||||
|
||||
nsresult rv = nsAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccUtils::SetAccAttrsForXULContainerItem(mDOMNode, aAttributes);
|
||||
return NS_OK;
|
||||
void
|
||||
nsXULMenuitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(mDOMNode, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -92,7 +92,9 @@ public:
|
|||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
|
|
@ -201,20 +201,19 @@ nsXULTabAccessible::GetRelationByType(PRUint32 aRelationType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTabAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
void
|
||||
nsXULTabAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = nsLeafAccessible::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
|
||||
|
||||
return NS_OK;
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mDOMNode, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTabBoxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* XUL TabBox
|
||||
* to facilitate naming of the tabPanels object we will give this the name
|
||||
|
|
|
@ -61,7 +61,8 @@ public:
|
|||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
};
|
||||
|
|
|
@ -962,10 +962,20 @@ nsXULTreeItemAccessibleBase::Shutdown()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeItemAccessibleBase: nsAccessible public methods
|
||||
|
||||
// nsIAccessible::groupPosition
|
||||
nsresult
|
||||
nsXULTreeItemAccessibleBase::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
nsXULTreeItemAccessibleBase::GroupPosition(PRInt32 *aGroupLevel,
|
||||
PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
NS_ENSURE_ARG_POINTER(aGroupLevel);
|
||||
*aGroupLevel = 0;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aSimilarItemsInGroup);
|
||||
*aSimilarItemsInGroup = 0;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aPositionInGroup);
|
||||
*aPositionInGroup = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1005,8 +1015,10 @@ nsXULTreeItemAccessibleBase::GetAttributesInternal(nsIPersistentProperties *aAtt
|
|||
PRInt32 setSize = topCount + bottomCount;
|
||||
PRInt32 posInSet = topCount;
|
||||
|
||||
// set the group attributes
|
||||
nsAccUtils::SetAccGroupAttrs(aAttributes, level + 1, posInSet, setSize);
|
||||
*aGroupLevel = level + 1;
|
||||
*aSimilarItemsInGroup = setSize;
|
||||
*aPositionInGroup = posInSet;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ public:
|
|||
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||
nsIAccessibleRelation **aRelation);
|
||||
|
||||
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel,
|
||||
PRInt32 *aSimilarItemsInGroup,
|
||||
PRInt32 *aPositionInGroup);
|
||||
|
||||
NS_IMETHOD GetNumActions(PRUint8 *aCount);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
|
@ -196,7 +200,6 @@ public:
|
|||
virtual nsresult Shutdown();
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsIAccessible* GetParent();
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ _TEST_FILES =\
|
|||
$(warning test_elm_media.html temporarily disabled) \
|
||||
test_elm_plugin.html \
|
||||
test_events_caretmove.html \
|
||||
test_events_coalescence.html \
|
||||
test_events_doc.html \
|
||||
$(warning test_events_coalescence.html temporarily disabled) \
|
||||
$(warning test_events_doc.html temporarily disabled) \
|
||||
test_events_draganddrop.html \
|
||||
test_events_flush.html \
|
||||
test_events_focus.html \
|
||||
|
|
|
@ -28,7 +28,8 @@ function testAbsentAttrs(aAccOrElmOrID, aAbsentAttrs)
|
|||
}
|
||||
|
||||
/**
|
||||
* Test group object attributes (posinset, setsize and level)
|
||||
* Test group object attributes (posinset, setsize and level) and
|
||||
* nsIAccessible::groupPosition() method.
|
||||
*
|
||||
* @param aAccOrElmOrID [in] the ID, DOM node or accessible
|
||||
* @param aPosInSet [in] the value of 'posinset' attribute
|
||||
|
@ -37,15 +38,30 @@ function testAbsentAttrs(aAccOrElmOrID, aAbsentAttrs)
|
|||
*/
|
||||
function testGroupAttrs(aAccOrElmOrID, aPosInSet, aSetSize, aLevel)
|
||||
{
|
||||
var attrs = {
|
||||
"posinset": String(aPosInSet),
|
||||
"setsize": String(aSetSize)
|
||||
};
|
||||
var acc = getAccessible(aAccOrElmOrID);
|
||||
var levelObj = {}, posInSetObj = {}, setSizeObj = {};
|
||||
acc.groupPosition(levelObj, setSizeObj, posInSetObj);
|
||||
|
||||
if (aLevel)
|
||||
attrs["level"] = String(aLevel);
|
||||
if (aPosInSet && aSetSize) {
|
||||
is(posInSetObj.value, aPosInSet,
|
||||
"Wrong group position (posinset) for " + prettyName(aAccOrElmOrID));
|
||||
is(setSizeObj.value, aSetSize,
|
||||
"Wrong size of the group (setsize) for " + prettyName(aAccOrElmOrID));
|
||||
|
||||
testAttrs(aAccOrElmOrID, attrs, true);
|
||||
var attrs = {
|
||||
"posinset": String(aPosInSet),
|
||||
"setsize": String(aSetSize)
|
||||
};
|
||||
testAttrs(aAccOrElmOrID, attrs, true);
|
||||
}
|
||||
|
||||
if (aLevel) {
|
||||
is(levelObj.value, aLevel,
|
||||
"Wrong group level for " + prettyName(aAccOrElmOrID));
|
||||
|
||||
var attrs = { "level" : String(aLevel) };
|
||||
testAttrs(aAccOrElmOrID, attrs, true);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -23,6 +23,25 @@
|
|||
testGroupAttrs("opt1", 1, 2);
|
||||
testGroupAttrs("opt2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML select with options
|
||||
// XXX bug 469123
|
||||
//testGroupAttrs("select2_optgroup", 1, 3, 1);
|
||||
//testGroupAttrs("select2_opt3", 2, 3, 1);
|
||||
//testGroupAttrs("select2_opt4", 3, 3, 1);
|
||||
//testGroupAttrs("select2_opt1", 1, 2, 2);
|
||||
//testGroupAttrs("select2_opt2", 2, 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML input@type="radio" within form
|
||||
testGroupAttrs("radio1", 1, 2);
|
||||
testGroupAttrs("radio2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML input@type="radio" within document
|
||||
testGroupAttrs("radio3", 1, 2);
|
||||
testGroupAttrs("radio4", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML ul/ol
|
||||
testGroupAttrs("li1", 1, 3);
|
||||
|
@ -56,6 +75,28 @@
|
|||
testGroupAttrs("n_li11", 2, 3, 2);
|
||||
testGroupAttrs("n_li12", 3, 3, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA menu (menuitem, separator, menuitemradio and menuitemcheckbox)
|
||||
testGroupAttrs("menu_item1", 1, 2);
|
||||
testGroupAttrs("menu_item2", 2, 2);
|
||||
testGroupAttrs("menu_item1.1", 1, 2);
|
||||
testGroupAttrs("menu_item1.2", 2, 2);
|
||||
testGroupAttrs("menu_item1.3", 1, 3);
|
||||
testGroupAttrs("menu_item1.4", 2, 3);
|
||||
testGroupAttrs("menu_item1.5", 3, 3);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA tab
|
||||
testGroupAttrs("tab_1", 1, 3);
|
||||
testGroupAttrs("tab_2", 2, 3);
|
||||
testGroupAttrs("tab_3", 3, 3);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA radio
|
||||
testGroupAttrs("r1", 1, 3);
|
||||
testGroupAttrs("r2", 2, 3);
|
||||
testGroupAttrs("r3", 3, 3);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA grid
|
||||
testGroupAttrs("grid_row1", 1, 2);
|
||||
|
@ -80,6 +121,15 @@
|
|||
testGroupAttrs("treegrid_cell5", 1, 2);
|
||||
testGroupAttrs("treegrid_cell6", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML headings
|
||||
testGroupAttrs("h1", 0, 0, 1);
|
||||
testGroupAttrs("h2", 0, 0, 2);
|
||||
testGroupAttrs("h3", 0, 0, 3);
|
||||
testGroupAttrs("h4", 0, 0, 4);
|
||||
testGroupAttrs("h5", 0, 0, 5);
|
||||
testGroupAttrs("h6", 0, 0, 6);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -105,6 +155,23 @@
|
|||
<option id="opt2">option2</option>
|
||||
</select>
|
||||
|
||||
<select size="4">
|
||||
<optgroup id="select2_optgroup" label="group">
|
||||
<option id="select2_opt1">option1</option>
|
||||
<option id="select2_opt2">option2</option>
|
||||
</optgroup>
|
||||
<option id="select2_opt3">option3</option>
|
||||
<option id="select2_opt4">option4</option>
|
||||
</select>
|
||||
|
||||
<form>
|
||||
<input type="radio" id="radio1" name="group1"/>
|
||||
<input type="radio" id="radio2" name="group1"/>
|
||||
</form>
|
||||
|
||||
<input type="radio" id="radio3" name="group2"/>
|
||||
<input type="radio" id="radio4" name="group2"/>
|
||||
|
||||
<ul>
|
||||
<li id="li1">Oranges</li>
|
||||
<li id="li2">Apples</li>
|
||||
|
@ -141,6 +208,32 @@
|
|||
</span>
|
||||
</span>
|
||||
|
||||
<ul role="menubar">
|
||||
<li role="menuitem" aria-haspopup="true" id="menu_item1">File
|
||||
<ul role="menu">
|
||||
<li role="menuitem" id="menu_item1.1">New</li>
|
||||
<li role="menuitem" id="menu_item1.2">Open…</li>
|
||||
<li role="separator">-----</li>
|
||||
<li role="menuitem" id="menu_item1.3">Item</li>
|
||||
<li role="menuitemradio" id="menu_item1.4">Radio</li>
|
||||
<li role="menuitemcheckbox" id="menu_item1.5">Checkbox</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="menuitem" aria-haspopup="false" id="menu_item2">Help</li>
|
||||
</ul>
|
||||
|
||||
<ul id="tablist_1" role="tablist">
|
||||
<li id="tab_1" role="tab">Crust</li>
|
||||
<li id="tab_2" role="tab">Veges</li>
|
||||
<li id="tab_3" role="tab">Carnivore</li>
|
||||
</ul>
|
||||
|
||||
<ul id="rg1" role="radiogroup">
|
||||
<li id="r1" role="radio" aria-checked="false">Thai</li>
|
||||
<li id="r2" role="radio" aria-checked="false">Subway</li>
|
||||
<li id="r3" role="radio" aria-checked="false">Jimmy Johns</li>
|
||||
</ul>
|
||||
|
||||
<table role="grid">
|
||||
<tr role="row" id="grid_row1">
|
||||
<td role="gridcell" id="grid_cell1">cell1</td>
|
||||
|
@ -166,5 +259,13 @@
|
|||
<div role="gridcell" id="treegrid_cell6">cell2</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 id="h1">heading1</h1>
|
||||
<h2 id="h2">heading2</h2>
|
||||
<h3 id="h3">heading3</h3>
|
||||
<h4 id="h4">heading4</h4>
|
||||
<h5 id="h5">heading5</h5>
|
||||
<h6 id="h6">heading6</h6>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:listbox (bug 417317)
|
||||
testGroupAttrs("item1", "1", "2");
|
||||
testGroupAttrs("item2", "2", "2");
|
||||
testGroupAttrs("item1", 1, 2);
|
||||
testGroupAttrs("item2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:menu (bug 443881)
|
||||
|
@ -35,23 +35,33 @@
|
|||
menu2.open = true;
|
||||
|
||||
window.setTimeout(function() {
|
||||
testGroupAttrs("menu_item1.1", "1", "1");
|
||||
testGroupAttrs("menu_item1.2", "1", "3");
|
||||
testGroupAttrs("menu_item1.4", "2", "3");
|
||||
testGroupAttrs("menu_item2", "3", "3");
|
||||
testGroupAttrs("menu_item2.1", "1", "2", "1");
|
||||
testGroupAttrs("menu_item2.2", "2", "2", "1");
|
||||
testGroupAttrs("menu_item1.1", 1, 1);
|
||||
testGroupAttrs("menu_item1.2", 1, 3);
|
||||
testGroupAttrs("menu_item1.4", 2, 3);
|
||||
testGroupAttrs("menu_item2", 3, 3);
|
||||
testGroupAttrs("menu_item2.1", 1, 2, 1);
|
||||
testGroupAttrs("menu_item2.2", 2, 2, 1);
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 200);
|
||||
}, 200);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:tab
|
||||
testGroupAttrs("tab1", 1, 2);
|
||||
testGroupAttrs("tab2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:radio
|
||||
testGroupAttrs("radio1", 1, 2);
|
||||
testGroupAttrs("radio2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA menu (bug 441888)
|
||||
testGroupAttrs("aria-menuitem", "1", "3");
|
||||
testGroupAttrs("aria-menuitemcheckbox", "2", "3");
|
||||
testGroupAttrs("aria-menuitemradio", "3", "3");
|
||||
testGroupAttrs("aria-menuitem2", "1", "1");
|
||||
testGroupAttrs("aria-menuitem", 1, 3);
|
||||
testGroupAttrs("aria-menuitemcheckbox", 2, 3);
|
||||
testGroupAttrs("aria-menuitemradio", 3, 3);
|
||||
testGroupAttrs("aria-menuitem2", 1, 1);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -106,6 +116,22 @@
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab id="tab1" label="tab1"/>
|
||||
<tab id="tab2" label="tab3"/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel/>
|
||||
<tabpanel/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
||||
<radiogroup>
|
||||
<radio id="radio1" label="radio1"/>
|
||||
<radio id="radio2" label="radio2"/>
|
||||
</radiogroup>
|
||||
|
||||
<vbox>
|
||||
<description role="menuitem" id="aria-menuitem"
|
||||
value="conventional menuitem"/>
|
||||
|
|
|
@ -31,22 +31,22 @@
|
|||
|
||||
var tree = getAccessible(treeNode);
|
||||
var treeitem1 = tree.firstChild.nextSibling;
|
||||
testGroupAttrs(treeitem1, "1", "4", "1");
|
||||
testGroupAttrs(treeitem1, 1, 4, 1);
|
||||
|
||||
var treeitem2 = treeitem1.nextSibling;
|
||||
testGroupAttrs(treeitem2, "2", "4", "1");
|
||||
testGroupAttrs(treeitem2, 2, 4, 1);
|
||||
|
||||
var treeitem3 = treeitem2.nextSibling;
|
||||
testGroupAttrs(treeitem3, "1", "2", "2");
|
||||
testGroupAttrs(treeitem3, 1, 2, 2);
|
||||
|
||||
var treeitem4 = treeitem3.nextSibling;
|
||||
testGroupAttrs(treeitem4, "2", "2", "2");
|
||||
testGroupAttrs(treeitem4, 2, 2, 2);
|
||||
|
||||
var treeitem5 = treeitem4.nextSibling;
|
||||
testGroupAttrs(treeitem5, "3", "4", "1");
|
||||
testGroupAttrs(treeitem5, 3, 4, 1);
|
||||
|
||||
var treeitem6 = treeitem5.nextSibling;
|
||||
testGroupAttrs(treeitem6, "4", "4", "1");
|
||||
testGroupAttrs(treeitem6, 4, 4, 1);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ const EXT_STATE_VERTICAL = nsIAccessibleStates.EXT_STATE_VERTICAL;
|
|||
// OS detect
|
||||
const MAC = (navigator.platform.indexOf("Mac") != -1)? true : false;
|
||||
const LINUX = (navigator.platform.indexOf("Linux") != -1)? true : false;
|
||||
const SOLARIS = (navigator.platform.indexOf("SunOS") != -1)? true : false;
|
||||
const WIN = (navigator.platform.indexOf("Win") != -1)? true : false;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
|
||||
function doTest()
|
||||
{
|
||||
if (LINUX) {
|
||||
if (LINUX || SOLARIS) {
|
||||
// XXX: bug 527646
|
||||
|
||||
todo(false, "Failure on linux.");
|
||||
todo(false, "Failure on Linux and Solaris.");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ pref("browser.search.update", true);
|
|||
pref("browser.search.update.log", false);
|
||||
|
||||
// Check whether we need to perform engine updates every 6 hours
|
||||
pref("browser.search.updateinterval", 6);
|
||||
pref("browser.search.update.interval", 21600);
|
||||
|
||||
// Whether or not microsummary and generator updates are enabled
|
||||
pref("browser.microsummary.enabled", true);
|
||||
|
@ -910,7 +910,6 @@ pref("toolbar.customization.usesheet", false);
|
|||
#endif
|
||||
|
||||
pref("dom.ipc.plugins.enabled", false);
|
||||
pref("dom.ipc.tabs.enabled", false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
windowtype="Browser:About"
|
||||
onload="init(event);" onunload="uninit(event);"
|
||||
#ifdef XP_MACOSX
|
||||
inwindowmenu="false"
|
||||
buttons="extra2"
|
||||
align="end"
|
||||
#else
|
||||
|
|
|
@ -17,6 +17,11 @@ toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
|
|||
display: none;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] > #reload-button:not([displaystop]) + #stop-button,
|
||||
toolbar[mode="icons"] > #reload-button[displaystop] {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
#main-window:-moz-lwtheme {
|
||||
background-repeat: no-repeat;
|
||||
background-position: top right;
|
||||
|
|
|
@ -1064,6 +1064,8 @@ function BrowserStartup() {
|
|||
gURLBar.setAttribute("enablehistory", "false");
|
||||
}
|
||||
|
||||
CombinedStopReload.init();
|
||||
|
||||
allTabs.readPref();
|
||||
|
||||
setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
|
||||
|
@ -1388,6 +1390,8 @@ function BrowserShutdown()
|
|||
ctrlTab.uninit();
|
||||
allTabs.uninit();
|
||||
|
||||
CombinedStopReload.uninit();
|
||||
|
||||
gGestureSupport.init(false);
|
||||
|
||||
FullScreen.cleanup();
|
||||
|
@ -3319,6 +3323,8 @@ function BrowserCustomizeToolbar()
|
|||
if (splitter)
|
||||
splitter.parentNode.removeChild(splitter);
|
||||
|
||||
CombinedStopReload.uninit();
|
||||
|
||||
var customizeURL = "chrome://global/content/customizeToolbar.xul";
|
||||
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
|
||||
|
||||
|
@ -3389,6 +3395,8 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
|
|||
|
||||
UpdateUrlbarSearchSplitterState();
|
||||
|
||||
CombinedStopReload.init();
|
||||
|
||||
gHomeButton.updatePersonalToolbarStyle();
|
||||
|
||||
// Update the urlbar
|
||||
|
@ -3945,14 +3953,10 @@ var XULBrowserWindow = {
|
|||
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
const nsIChannel = Ci.nsIChannel;
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START) {
|
||||
// This (thanks to the filter) is a network start or the first
|
||||
// stray request (the first request outside of the document load),
|
||||
// initialize the throbber and his friends.
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
|
||||
// Call start document load listeners (only if this is a network load)
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
|
||||
aRequest && aWebProgress.DOMWindow == content)
|
||||
if (aRequest && aWebProgress.DOMWindow == content)
|
||||
this.startDocumentLoad(aRequest);
|
||||
|
||||
this.isBusy = true;
|
||||
|
@ -3975,6 +3979,7 @@ var XULBrowserWindow = {
|
|||
|
||||
// XXX: This needs to be based on window activity...
|
||||
this.stopCommand.removeAttribute("disabled");
|
||||
CombinedStopReload.switchToStop();
|
||||
}
|
||||
}
|
||||
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
|
||||
|
@ -4042,6 +4047,7 @@ var XULBrowserWindow = {
|
|||
this.throbberElement.removeAttribute("busy");
|
||||
|
||||
this.stopCommand.setAttribute("disabled", "true");
|
||||
CombinedStopReload.switchToReload(aRequest instanceof Ci.nsIRequest);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -4316,7 +4322,85 @@ var XULBrowserWindow = {
|
|||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var CombinedStopReload = {
|
||||
init: function () {
|
||||
if (this._initialized)
|
||||
return;
|
||||
|
||||
var stop = document.getElementById("stop-button");
|
||||
if (!stop)
|
||||
return;
|
||||
|
||||
var reload = document.getElementById("reload-button");
|
||||
if (!reload)
|
||||
return;
|
||||
|
||||
if (!(reload.nextSibling == stop))
|
||||
return;
|
||||
|
||||
this._initialized = true;
|
||||
if (XULBrowserWindow.stopCommand.getAttribute("disabled") != "true")
|
||||
reload.setAttribute("displaystop", "true");
|
||||
stop.addEventListener("click", this, false);
|
||||
this.stop = stop;
|
||||
this.reload = reload;
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
if (!this._initialized)
|
||||
return;
|
||||
|
||||
this._cancelTransition();
|
||||
this._initialized = false;
|
||||
this.stop.removeEventListener("click", this, false);
|
||||
this.reload = null;
|
||||
this.stop = null;
|
||||
},
|
||||
|
||||
handleEvent: function (event) {
|
||||
// the only event we listen to is "click" on the stop button
|
||||
if (event.button == 0 &&
|
||||
!this.stop.disabled)
|
||||
this._stopClicked = true;
|
||||
},
|
||||
|
||||
switchToStop: function () {
|
||||
if (!this._initialized)
|
||||
return;
|
||||
|
||||
this._cancelTransition();
|
||||
this.reload.setAttribute("displaystop", "true");
|
||||
},
|
||||
|
||||
switchToReload: function (aDelay) {
|
||||
if (!this._initialized)
|
||||
return;
|
||||
|
||||
if (!aDelay || this._stopClicked) {
|
||||
this._stopClicked = false;
|
||||
this._cancelTransition();
|
||||
this.reload.removeAttribute("displaystop");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._timer)
|
||||
return;
|
||||
|
||||
this._timer = setTimeout(function (self) {
|
||||
self._timer = 0;
|
||||
self.reload.removeAttribute("displaystop");
|
||||
}, 650, this);
|
||||
},
|
||||
|
||||
_cancelTransition: function () {
|
||||
if (this._timer) {
|
||||
clearTimeout(this._timer);
|
||||
this._timer = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var TabsProgressListener = {
|
||||
onProgressChange: function (aBrowser, aWebProgress, aRequest,
|
||||
|
@ -4328,7 +4412,8 @@ var TabsProgressListener = {
|
|||
#ifdef MOZ_CRASHREPORTER
|
||||
if (aRequest instanceof Ci.nsIChannel &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT &&
|
||||
gCrashReporter.enabled) {
|
||||
gCrashReporter.annotateCrashReport("URL", aRequest.URI.spec);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -125,11 +125,13 @@ function uri(spec) {
|
|||
function remove_all_bookmarks() {
|
||||
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
// Clear all bookmarks
|
||||
// Clear all bookmarks.
|
||||
bs.removeFolderChildren(bs.bookmarksMenuFolder);
|
||||
bs.removeFolderChildren(bs.toolbarFolder);
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
// Check for correct cleanup
|
||||
|
||||
// Check for correct cleanup.
|
||||
dump_table("moz_bookmarks");
|
||||
check_no_bookmarks()
|
||||
}
|
||||
|
||||
|
@ -148,7 +150,13 @@ function check_no_bookmarks() {
|
|||
var result = hs.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
root.containerOpen = true;
|
||||
do_check_eq(root.childCount, 0);
|
||||
var cc = root.childCount;
|
||||
// Dump contents if found.
|
||||
for (var i = 0; i < cc ; i++) {
|
||||
var node = root.getChild(i);
|
||||
print("Found unexpected child at " + i + ": " + node.title);
|
||||
}
|
||||
do_check_eq(cc, 0);
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,8 @@ function continue_test() {
|
|||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
dump_table("moz_bookmarks");
|
||||
|
||||
// Check the custom bookmarks exist on menu.
|
||||
let menuItemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, 0);
|
||||
do_check_neq(menuItemId, -1);
|
||||
|
|
|
@ -225,7 +225,8 @@ function next_test() {
|
|||
|
||||
// nsBrowserGlue stops observing topics after first notification,
|
||||
// so we add back the observer to test additional runs.
|
||||
os.addObserver(bg, TOPIC_PLACES_INIT_COMPLETE, false);
|
||||
if (testIndex > 0)
|
||||
os.addObserver(bg, TOPIC_PLACES_INIT_COMPLETE, false);
|
||||
|
||||
// Execute next test.
|
||||
let test = tests.shift();
|
||||
|
|
|
@ -186,6 +186,11 @@ function countFolderChildren(aFolderItemId) {
|
|||
var rootNode = hs.executeQuery(query, options).root;
|
||||
rootNode.containerOpen = true;
|
||||
var cc = rootNode.childCount;
|
||||
// Dump contents.
|
||||
for (var i = 0; i < cc ; i++) {
|
||||
var node = rootNode.getChild(i);
|
||||
print("Found child at " + i + ": " + node.title);
|
||||
}
|
||||
rootNode.containerOpen = false;
|
||||
return cc;
|
||||
}
|
||||
|
@ -201,7 +206,8 @@ var testIndex = 0;
|
|||
function next_test() {
|
||||
// nsBrowserGlue stops observing topics after first notification,
|
||||
// so we add back the observer to test additional runs.
|
||||
os.addObserver(bg, TOPIC_PLACES_INIT_COMPLETE, false);
|
||||
if (testIndex > 0)
|
||||
os.addObserver(bg, TOPIC_PLACES_INIT_COMPLETE, false);
|
||||
|
||||
// Execute next test.
|
||||
let test = tests.shift();
|
||||
|
@ -210,9 +216,6 @@ function next_test() {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
// XXX disabled due to bug 510219
|
||||
return;
|
||||
|
||||
// Clean up database from all bookmarks.
|
||||
remove_all_bookmarks();
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ l10n-upload-%:
|
|||
ifdef MOZ_MAKE_COMPLETE_MAR
|
||||
$(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) $(DIST)/$(COMPLETE_MAR)
|
||||
endif
|
||||
ifeq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
||||
$(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) "$(INSTALLER_PACKAGE)"
|
||||
endif
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
import codecs
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
|
@ -569,8 +569,11 @@ def runApp(testURL, env, app, profileDir, extraArgs,
|
|||
runSSLTunnel = False, utilityPath = DIST_BIN,
|
||||
xrePath = DIST_BIN, certPath = CERTS_SRC_DIR,
|
||||
debuggerInfo = None, symbolsPath = None,
|
||||
timeout = DEFAULT_TIMEOUT):
|
||||
"Run the app, log the duration it took to execute, return the status code."
|
||||
timeout = DEFAULT_TIMEOUT, maxTime = None):
|
||||
"""
|
||||
Run the app, log the duration it took to execute, return the status code.
|
||||
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing for |timeout| seconds.
|
||||
"""
|
||||
|
||||
# copy env so we don't munge the caller's environment
|
||||
env = dict(env);
|
||||
|
@ -652,19 +655,25 @@ def runApp(testURL, env, app, profileDir, extraArgs,
|
|||
logsource = stackFixerProcess.stdout
|
||||
|
||||
(line, didTimeout) = readWithTimeout(logsource, timeout)
|
||||
hitMaxTime = False
|
||||
while line != "" and not didTimeout:
|
||||
log.info(line.rstrip())
|
||||
(line, didTimeout) = readWithTimeout(logsource, timeout)
|
||||
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime):
|
||||
# Kill the application, but continue reading from stack fixer so as not to deadlock on stackFixerProcess.wait().
|
||||
hitMaxTime = True
|
||||
log.info("TEST-UNEXPECTED-FAIL | automation.py | application ran for longer than allowed maximum time of %d seconds", int(maxTime))
|
||||
triggerBreakpad(proc, utilityPath)
|
||||
if didTimeout:
|
||||
log.info("TEST-UNEXPECTED-FAIL | automation.py | application timed out after %d seconds with no output", int(timeout))
|
||||
triggerBreakpad(proc, utilityPath)
|
||||
|
||||
status = proc.wait()
|
||||
if status != 0 and not didTimeout:
|
||||
if status != 0 and not didTimeout and not hitMaxTime:
|
||||
log.info("TEST-UNEXPECTED-FAIL | automation.py | Exited with code %d during test run", status)
|
||||
if stackFixerProcess is not None:
|
||||
fixerStatus = stackFixerProcess.wait()
|
||||
if fixerStatus != 0 and not didTimeout:
|
||||
if fixerStatus != 0 and not didTimeout and not hitMaxTime:
|
||||
log.info("TEST-UNEXPECTED-FAIL | automation.py | Stack fixer process exited with code %d during test run", fixerStatus)
|
||||
log.info("INFO | automation.py | Application ran for: %s", str(datetime.now() - startTime))
|
||||
|
||||
|
|
Двоичные данные
build/pgo/certs/cert8.db
Двоичные данные
build/pgo/certs/cert8.db
Двоичный файл не отображается.
Двоичные данные
build/pgo/certs/key3.db
Двоичные данные
build/pgo/certs/key3.db
Двоичный файл не отображается.
|
@ -113,6 +113,7 @@ https://sub2.test2.example.com:443 privileged
|
|||
https://nocert.example.com:443 privileged,nocert
|
||||
https://self-signed.example.com:443 privileged,cert=selfsigned
|
||||
https://untrusted.example.com:443 privileged,cert=untrusted
|
||||
https://expired.example.com:443 privileged,cert=expired
|
||||
https://requestclientcert.example.com:443 privileged,clientauth=request
|
||||
https://requireclientcert.example.com:443 privileged,clientauth=require
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#define UILOCALE_CMD_LINE_ARG "UILocale"
|
||||
|
||||
|
@ -956,9 +955,8 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow,
|
|||
return NS_OK;
|
||||
|
||||
// Deal with the agent sheets first. Have to do all the style sets by hand.
|
||||
nsPresShellIterator iter(document);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = document->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// Reload only the chrome URL agent style sheets.
|
||||
nsCOMArray<nsIStyleSheet> agentSheets;
|
||||
rv = shell->GetAgentStyleSheets(agentSheets);
|
||||
|
|
|
@ -655,3 +655,6 @@ MOZ_SPLASHSCREEN = @MOZ_SPLASHSCREEN@
|
|||
MOZ_THEME_FASTSTRIPE = @MOZ_THEME_FASTSTRIPE@
|
||||
|
||||
MOZ_OFFICIAL_BRANDING = @MOZ_OFFICIAL_BRANDING@
|
||||
|
||||
HAVE_CLOCK_MONOTONIC = @HAVE_CLOCK_MONOTONIC@
|
||||
REALTIME_LIBS = @REALTIME_LIBS@
|
||||
|
|
|
@ -1229,7 +1229,7 @@ ifndef XP_MACOSX
|
|||
ifdef DTRACE_PROBE_OBJ
|
||||
ifndef DTRACE_LIB_DEPENDENT
|
||||
$(DTRACE_PROBE_OBJ): $(OBJS)
|
||||
dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
|
||||
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -1281,7 +1281,7 @@ ifdef DTRACE_LIB_DEPENDENT
|
|||
@rm -f $(PROBE_LOBJS)
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
|
||||
ifndef XP_MACOSX
|
||||
dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
|
||||
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
|
||||
endif
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do \
|
||||
ofiles=`$(AR_LIST) $${lib}`; \
|
||||
|
|
41
configure.in
41
configure.in
|
@ -110,7 +110,7 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
|
|||
dnl Set the version number of the libs included with mozilla
|
||||
dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10217
|
||||
MOZPNG=10400
|
||||
MOZZLIB=0x1230
|
||||
NSPR_VERSION=4
|
||||
NSS_VERSION=3
|
||||
|
@ -133,7 +133,7 @@ LIBGNOME_VERSION=2.0
|
|||
GIO_VERSION=2.0
|
||||
STARTUP_NOTIFICATION_VERSION=0.8
|
||||
DBUS_VERSION=0.60
|
||||
SQLITE_VERSION=3.6.20
|
||||
SQLITE_VERSION=3.6.22
|
||||
LIBNOTIFY_VERSION=0.4
|
||||
|
||||
MSMANIFEST_TOOL=
|
||||
|
@ -1533,6 +1533,24 @@ if test "$GNU_CXX"; then
|
|||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
|
||||
ac_has_werror_return_type,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror=return-type"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_werror_return_type="yes",
|
||||
ac_has_werror_return_type="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_werror_return_type" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
|
||||
fi
|
||||
|
||||
else
|
||||
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
|
||||
fi
|
||||
|
@ -3582,6 +3600,25 @@ AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat6
|
|||
AC_CHECK_FUNCS(flockfile getpagesize)
|
||||
AC_CHECK_FUNCS(localtime_r strtok_r)
|
||||
|
||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -lrt"
|
||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
|
||||
ac_cv_have_clock_monotonic,
|
||||
[AC_TRY_LINK([#include <time.h>],
|
||||
[ struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
||||
ac_cv_have_clock_monotonic=yes,
|
||||
ac_cv_have_clock_monotonic=no)])
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
if test "$ac_cv_have_clock_monotonic" = "yes"; then
|
||||
HAVE_CLOCK_MONOTONIC=1
|
||||
REALTIME_LIBS=-lrt
|
||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
||||
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
||||
AC_SUBST(REALTIME_LIBS)
|
||||
fi
|
||||
|
||||
dnl check for wcrtomb/mbrtowc
|
||||
dnl =======================================================================
|
||||
if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
|
||||
|
|
|
@ -75,7 +75,6 @@ nsCopySupport.h \
|
|||
nsContentCreatorFunctions.h \
|
||||
nsDOMFile.h \
|
||||
nsLineBreaker.h \
|
||||
nsPresShellIterator.h \
|
||||
nsReferencedElement.h \
|
||||
nsXMLNameSpaceMap.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -128,10 +128,6 @@
|
|||
#define NS_CSSPARSER_CID \
|
||||
{ 0x2e363d60, 0x872e, 0x11d2, { 0xb5, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {A1FDE867-E802-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_CSS_STYLESHEET_CID \
|
||||
{ 0xa1fde867, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
// {eaca2576-0d4a-11d3-9d7e-0060088f9ff7}
|
||||
#define NS_CSS_LOADER_CID \
|
||||
{ 0xeaca2576, 0x0d4a, 0x11d3, { 0x9d, 0x7e, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7 } }
|
||||
|
|
|
@ -105,8 +105,8 @@ class nsIBoxObject;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xd16d73c1, 0xe0f7, 0x415c, \
|
||||
{ 0xbd, 0x68, 0x9c, 0x1f, 0x93, 0xb8, 0x73, 0x7a } }
|
||||
{ 0x1539ada4, 0x753f, 0x48a9, \
|
||||
{ 0x83, 0x11, 0x71, 0xb9, 0xbd, 0xa6, 0x41, 0xc6 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -409,10 +409,15 @@ public:
|
|||
nsIViewManager* aViewManager,
|
||||
nsStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult) = 0;
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell) = 0;
|
||||
virtual nsIPresShell *GetPrimaryShell() const = 0;
|
||||
void SetShellsHidden(PRBool aHide) { mShellsAreHidden = aHide; }
|
||||
PRBool ShellsAreHidden() const { return mShellsAreHidden; }
|
||||
void DeleteShell() { mPresShell = nsnull; }
|
||||
|
||||
nsIPresShell* GetPrimaryShell() const
|
||||
{
|
||||
return mShellIsHidden ? nsnull : mPresShell;
|
||||
}
|
||||
|
||||
void SetShellHidden(PRBool aHide) { mShellIsHidden = aHide; }
|
||||
PRBool ShellIsHidden() const { return mShellIsHidden; }
|
||||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
|
@ -1247,7 +1252,6 @@ protected:
|
|||
virtual void WillDispatchMutationEvent(nsINode* aTarget) = 0;
|
||||
virtual void MutationEventDispatched(nsINode* aTarget) = 0;
|
||||
friend class mozAutoSubtreeModified;
|
||||
friend class nsPresShellIterator;
|
||||
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIURI> mDocumentBaseURI;
|
||||
|
@ -1296,7 +1300,7 @@ protected:
|
|||
// document in it.
|
||||
PRPackedBool mIsInitialDocumentInWindow;
|
||||
|
||||
PRPackedBool mShellsAreHidden;
|
||||
PRPackedBool mShellIsHidden;
|
||||
|
||||
PRPackedBool mIsRegularHTML;
|
||||
|
||||
|
@ -1355,7 +1359,7 @@ protected:
|
|||
// won't be collected
|
||||
PRUint32 mMarkedCCGeneration;
|
||||
|
||||
nsTObserverArray<nsIPresShell*> mPresShells;
|
||||
nsIPresShell* mPresShell;
|
||||
|
||||
nsCOMArray<nsINode> mSubtreeModifiedTargets;
|
||||
PRUint32 mSubtreeModifiedDepth;
|
||||
|
|
|
@ -95,7 +95,6 @@
|
|||
#include "nsNodeUtils.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
@ -1229,9 +1228,8 @@ nsContentSink::ScrollToRef()
|
|||
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
|
||||
NS_ConvertUTF8toUTF16 ref(unescapedRef);
|
||||
|
||||
nsPresShellIterator iter(mDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// Check an empty string which might be caused by the UTF-8 conversion
|
||||
if (!ref.IsEmpty()) {
|
||||
// Note that GoToAnchor will handle flushing layout as needed.
|
||||
|
@ -1309,24 +1307,13 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
|
|||
mLastNotificationTime = PR_Now();
|
||||
|
||||
mDocument->SetMayStartLayout(PR_TRUE);
|
||||
nsPresShellIterator iter(mDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
// Make sure we don't call InitialReflow() for a shell that has
|
||||
// already called it. This can happen when the layout frame for
|
||||
// an iframe is constructed *between* the Embed() call for the
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
|
||||
if (shell->DidInitialReflow()) {
|
||||
// XXX: The assumption here is that if something already
|
||||
// called InitialReflow() on this shell, it also did some of
|
||||
// the setup below, so we do nothing and just move on to the
|
||||
// next shell in the list.
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
|
||||
// Make sure we don't call InitialReflow() for a shell that has
|
||||
// already called it. This can happen when the layout frame for
|
||||
// an iframe is constructed *between* the Embed() call for the
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
nsRect r = shell->GetPresContext()->GetVisibleArea();
|
||||
nsCOMPtr<nsIPresShell> shellGrip = shell;
|
||||
nsresult rv = shell->InitialReflow(r.width, r.height);
|
||||
|
|
|
@ -2084,9 +2084,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
}
|
||||
}
|
||||
|
@ -2106,9 +2105,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
nsStyleSet::sheetType attrSheetType = GetAttrSheetType();
|
||||
if (mAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(attrSheetType, mAttrStyleSheet);
|
||||
}
|
||||
rv = mAttrStyleSheet->Reset(aURI);
|
||||
|
@ -2123,9 +2121,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
|
||||
if (mStyleAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->
|
||||
RemoveStyleSheet(nsStyleSet::eStyleAttrSheet, mStyleAttrStyleSheet);
|
||||
}
|
||||
|
@ -2142,9 +2139,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
mStyleAttrStyleSheet->SetOwningDocument(this);
|
||||
|
||||
// Now set up our style sets
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
FillStyleSet(shell->StyleSet());
|
||||
}
|
||||
|
||||
|
@ -3045,7 +3041,9 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
|||
{
|
||||
*aInstancePtrResult = nsnull;
|
||||
|
||||
NS_ENSURE_FALSE(mShellsAreHidden, NS_ERROR_FAILURE);
|
||||
NS_ASSERTION(!mPresShell, "We have a presshell already!");
|
||||
|
||||
NS_ENSURE_FALSE(mShellIsHidden, NS_ERROR_FAILURE);
|
||||
|
||||
FillStyleSet(aStyleSet);
|
||||
|
||||
|
@ -3059,29 +3057,13 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Note: we don't hold a ref to the shell (it holds a ref to us)
|
||||
NS_ENSURE_TRUE(mPresShells.AppendElementUnlessExists(shell),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_WARN_IF_FALSE(mPresShells.Length() == 1, "More than one presshell!");
|
||||
mPresShell = shell;
|
||||
|
||||
shell.swap(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDocument::DeleteShell(nsIPresShell* aShell)
|
||||
{
|
||||
return mPresShells.RemoveElement(aShell);
|
||||
}
|
||||
|
||||
|
||||
nsIPresShell *
|
||||
nsDocument::GetPrimaryShell() const
|
||||
{
|
||||
return mShellsAreHidden ? nsnull : mPresShells.SafeElementAt(0, nsnull);
|
||||
}
|
||||
|
||||
static void
|
||||
SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
|
@ -3341,9 +3323,8 @@ nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet) const
|
|||
void
|
||||
nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
|
||||
}
|
||||
}
|
||||
|
@ -3368,9 +3349,8 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
|||
void
|
||||
nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
|
||||
}
|
||||
}
|
||||
|
@ -3507,9 +3487,8 @@ nsDocument::AddCatalogStyleSheet(nsIStyleSheet* aSheet)
|
|||
|
||||
if (applicable) {
|
||||
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->AppendStyleSheet(nsStyleSet::eAgentSheet, aSheet);
|
||||
}
|
||||
}
|
||||
|
@ -3610,6 +3589,13 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
"Script global object must be an inner window!");
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_SMIL
|
||||
NS_ABORT_IF_FALSE(aScriptGlobalObject || !mAnimationController ||
|
||||
mAnimationController->IsPausedByType(
|
||||
nsSMILTimeContainer::PAUSE_PAGEHIDE |
|
||||
nsSMILTimeContainer::PAUSE_BEGIN),
|
||||
"Clearing window pointer while animations are unpaused");
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
if (mScriptGlobalObject && !aScriptGlobalObject) {
|
||||
// We're detaching from the window. We need to grab a pointer to
|
||||
|
@ -5076,18 +5062,15 @@ nsDocument::DoNotifyPossibleTitleChange()
|
|||
nsAutoString title;
|
||||
GetTitle(title);
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsCOMPtr<nsISupports> container = shell->GetPresContext()->GetContainer();
|
||||
if (!container)
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
|
||||
if (!docShellWin)
|
||||
continue;
|
||||
|
||||
docShellWin->SetTitle(PromiseFlatString(title).get());
|
||||
if (container) {
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
|
||||
if (docShellWin) {
|
||||
docShellWin->SetTitle(PromiseFlatString(title).get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fire a DOM event for the title change.
|
||||
|
@ -5349,7 +5332,7 @@ nsDocument::GetAnimationController()
|
|||
return mAnimationController;
|
||||
// Refuse to create an Animation Controller if SMIL is disabled, and also
|
||||
// for data documents.
|
||||
if (!NS_SMILEnabled() || mLoadedAsData)
|
||||
if (!NS_SMILEnabled() || mLoadedAsData || mLoadedAsInteractiveData)
|
||||
return nsnull;
|
||||
|
||||
mAnimationController = NS_NewSMILAnimationController(this);
|
||||
|
@ -6354,9 +6337,8 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
|||
mParentDocument->FlushPendingNotifications(parentType);
|
||||
}
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->FlushPendingNotifications(aType);
|
||||
}
|
||||
}
|
||||
|
@ -6766,10 +6748,8 @@ PRBool
|
|||
nsDocument::IsSafeToFlush() const
|
||||
{
|
||||
PRBool isSafeToFlush = PR_TRUE;
|
||||
nsPresShellIterator iter(const_cast<nsIDocument*>
|
||||
(static_cast<const nsIDocument*>(this)));
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell()) && isSafeToFlush) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->IsSafeToFlush(isSafeToFlush);
|
||||
}
|
||||
return isSafeToFlush;
|
||||
|
@ -7179,12 +7159,23 @@ nsDocument::DispatchPageTransition(nsPIDOMEventTarget* aDispatchTarget,
|
|||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NotifyPageShow(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
const PRBool* aPersistedPtr = static_cast<const PRBool*>(aData);
|
||||
aDocument->OnPageShow(*aPersistedPtr, nsnull);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::OnPageShow(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarget)
|
||||
nsDocument::OnPageShow(PRBool aPersisted,
|
||||
nsIDOMEventTarget* aDispatchStartTarget)
|
||||
{
|
||||
mVisible = PR_TRUE;
|
||||
|
||||
EnumerateFreezableElements(NotifyActivityChanged, nsnull);
|
||||
EnumerateFreezableElements(NotifyActivityChanged, nsnull);
|
||||
EnumerateExternalResources(NotifyPageShow, &aPersisted);
|
||||
|
||||
UpdateLinkMap();
|
||||
|
||||
nsIContent* root = GetRootContent();
|
||||
|
@ -7223,8 +7214,17 @@ nsDocument::OnPageShow(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarge
|
|||
DispatchPageTransition(target, NS_LITERAL_STRING("pageshow"), aPersisted);
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NotifyPageHide(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
const PRBool* aPersistedPtr = static_cast<const PRBool*>(aData);
|
||||
aDocument->OnPageHide(*aPersistedPtr, nsnull);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::OnPageHide(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarget)
|
||||
nsDocument::OnPageHide(PRBool aPersisted,
|
||||
nsIDOMEventTarget* aDispatchStartTarget)
|
||||
{
|
||||
// Send out notifications that our <link> elements are detached,
|
||||
// but only if this is not a full unload.
|
||||
|
@ -7265,6 +7265,7 @@ nsDocument::OnPageHide(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarge
|
|||
DispatchPageTransition(target, NS_LITERAL_STRING("pagehide"), aPersisted);
|
||||
|
||||
mVisible = PR_FALSE;
|
||||
EnumerateExternalResources(NotifyPageHide, &aPersisted);
|
||||
EnumerateFreezableElements(NotifyActivityChanged, nsnull);
|
||||
}
|
||||
|
||||
|
@ -7703,9 +7704,8 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
|
|||
for (PRUint32 i = 0; i < aDocuments.Length(); ++i) {
|
||||
if (!aDocuments[i]->EventHandlingSuppressed()) {
|
||||
fm->FireDelayedEvents(aDocuments[i]);
|
||||
nsPresShellIterator iter(aDocuments[i]);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->FireOrClearDelayedEvents(aFireEvents);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
#include "pldhash.h"
|
||||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
@ -666,8 +665,6 @@ public:
|
|||
nsIViewManager* aViewManager,
|
||||
nsStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||
virtual nsIPresShell *GetPrimaryShell() const;
|
||||
|
||||
virtual nsresult SetSubDocumentFor(nsIContent *aContent,
|
||||
nsIDocument* aSubDoc);
|
||||
|
@ -1195,6 +1192,11 @@ protected:
|
|||
|
||||
PRPackedBool mInXBLUpdate:1;
|
||||
|
||||
// This flag is only set in nsXMLDocument, for e.g. documents used in XBL. We
|
||||
// don't want animations to play in such documents, so we need to store the
|
||||
// flag here so that we can check it in nsDocument::GetAnimationController.
|
||||
PRPackedBool mLoadedAsInteractiveData:1;
|
||||
|
||||
PRUint8 mXMLDeclarationBits;
|
||||
|
||||
PRUint8 mDefaultElementType;
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsISHistory.h"
|
||||
|
@ -722,12 +721,6 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
NS_ASSERTION(ourDoc == ourParentDocument, "Unexpected parent document");
|
||||
NS_ASSERTION(otherDoc == otherParentDocument, "Unexpected parent document");
|
||||
|
||||
nsPresShellIterator iter1(ourDoc);
|
||||
nsPresShellIterator iter2(otherDoc);
|
||||
if (iter1.HasMoreThanOneShell() || iter2.HasMoreThanOneShell()) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIPresShell* ourShell = ourDoc->GetPrimaryShell();
|
||||
nsIPresShell* otherShell = otherDoc->GetPrimaryShell();
|
||||
if (!ourShell || !otherShell) {
|
||||
|
|
|
@ -396,8 +396,8 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
|
|||
if (!IsNodeOfType(eCONTENT))
|
||||
return nsnull;
|
||||
|
||||
NS_ASSERTION(GetCurrentDoc() == aPresShell->GetDocument(),
|
||||
"Wrong document somewhere");
|
||||
NS_ENSURE_TRUE(GetCurrentDoc() == aPresShell->GetDocument(), nsnull);
|
||||
|
||||
nsIFrame* frame = static_cast<nsIContent*>(this)->GetPrimaryFrame();
|
||||
if (frame && frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION) {
|
||||
// This node should be a descendant of input/textarea editor.
|
||||
|
@ -3007,9 +3007,8 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
|||
// be in a document, if we're clearing animation effects on a target node
|
||||
// that's been detached since the previous animation sample.)
|
||||
if (doc) {
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while (shell = iter.GetNextShell()) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
presContext->SMILOverrideStyleChanged(this);
|
||||
}
|
||||
|
|
|
@ -573,6 +573,7 @@ GK_ATOM(NaN, "NaN")
|
|||
GK_ATOM(negate, "negate")
|
||||
GK_ATOM(never, "never")
|
||||
GK_ATOM(_new, "new")
|
||||
GK_ATOM(newline, "newline")
|
||||
GK_ATOM(nextBidi, "NextBidi")
|
||||
GK_ATOM(no, "no")
|
||||
GK_ATOM(noautohide, "noautohide")
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsStyleUtil.h"
|
||||
|
||||
|
@ -761,9 +760,8 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->RecreateFramesFor(thisContent);
|
||||
}
|
||||
|
||||
|
@ -1543,10 +1541,8 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
|||
} else if (aOldType != mType) {
|
||||
// If our state changed, then we already recreated frames
|
||||
// Otherwise, need to do that here
|
||||
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->RecreateFramesFor(thisContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* A base class implementING nsIObjectLoadingContent for use by
|
||||
* A base class implementing nsIObjectLoadingContent for use by
|
||||
* various content nodes that want to provide plugin/document/image
|
||||
* loading functionality (eg <embed>, <object>, <applet>, etc).
|
||||
*/
|
||||
|
|
|
@ -387,24 +387,6 @@ protected:
|
|||
PRUint32 mInvalidateCount;
|
||||
static const PRUint32 kCanvasMaxInvalidateCount = 100;
|
||||
|
||||
/**
|
||||
* Returns true iff the the given operator should affect areas of the
|
||||
* destination where the source is transparent. Among other things, this
|
||||
* implies that a fully transparent source would still affect the canvas.
|
||||
*/
|
||||
PRBool OperatorAffectsUncoveredAreas(gfxContext::GraphicsOperator op) const
|
||||
{
|
||||
return PR_FALSE;
|
||||
// XXX certain operators cause 2d.composite.uncovered.* tests to fail
|
||||
#if 0
|
||||
return op == gfxContext::OPERATOR_IN ||
|
||||
op == gfxContext::OPERATOR_OUT ||
|
||||
op == gfxContext::OPERATOR_DEST_IN ||
|
||||
op == gfxContext::OPERATOR_DEST_ATOP ||
|
||||
op == gfxContext::OPERATOR_SOURCE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff a shadow should be drawn along with a
|
||||
* drawing operation.
|
||||
|
@ -413,34 +395,28 @@ protected:
|
|||
{
|
||||
ContextState& state = CurrentState();
|
||||
|
||||
// special case the default values as a "don't draw shadows" mode
|
||||
PRBool doDraw = state.colorStyles[STYLE_SHADOW] != 0 ||
|
||||
state.shadowOffset.x != 0 ||
|
||||
state.shadowOffset.y != 0;
|
||||
PRBool isColor = CurrentState().StyleIsColor(STYLE_SHADOW);
|
||||
|
||||
// if not using one of the cooky operators, can avoid drawing a shadow
|
||||
// if the color is fully transparent
|
||||
return (doDraw || !isColor) && (!isColor ||
|
||||
NS_GET_A(state.colorStyles[STYLE_SHADOW]) != 0 ||
|
||||
OperatorAffectsUncoveredAreas(mThebes->CurrentOperator()));
|
||||
// The spec says we should not draw shadows when the alpha value is 0,
|
||||
// regardless of the operator being used.
|
||||
return state.StyleIsColor(STYLE_SHADOW) &&
|
||||
NS_GET_A(state.colorStyles[STYLE_SHADOW]) > 0 &&
|
||||
(state.shadowOffset != gfxPoint(0, 0) || state.shadowBlur != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the current state to determine if an intermediate surface would
|
||||
* be necessary to complete a drawing operation. Does not check the
|
||||
* condition pertaining to global alpha and patterns since that does not
|
||||
* pertain to all drawing operations.
|
||||
* If the current operator is "source" then clear the destination before we
|
||||
* draw into it, to simulate the effect of an unbounded source operator.
|
||||
*/
|
||||
PRBool NeedToUseIntermediateSurface()
|
||||
void ClearSurfaceForUnboundedSource()
|
||||
{
|
||||
// certain operators always need an intermediate surface, except
|
||||
// with quartz since quartz does compositing differently than cairo
|
||||
return mThebes->OriginalSurface()->GetType() != gfxASurface::SurfaceTypeQuartz &&
|
||||
OperatorAffectsUncoveredAreas(mThebes->CurrentOperator());
|
||||
|
||||
// XXX there are other unhandled cases but they should be investigated
|
||||
// first to ensure we aren't using an intermediate surface unecessarily
|
||||
gfxContext::GraphicsOperator current = mThebes->CurrentOperator();
|
||||
if (current != gfxContext::OPERATOR_SOURCE)
|
||||
return;
|
||||
mThebes->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||
// It doesn't really matter what the source is here, since Paint
|
||||
// isn't bounded by the source and the mask covers the entire clip
|
||||
// region.
|
||||
mThebes->Paint();
|
||||
mThebes->SetOperator(current);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1504,13 +1480,15 @@ nsCanvasRenderingContext2D::DrawPath(Style style, gfxRect *dirtyRect)
|
|||
/*
|
||||
* Need an intermediate surface when:
|
||||
* - globalAlpha != 1 and gradients/patterns are used (need to paint_with_alpha)
|
||||
* - certain operators are used and are not on mac (quartz/cairo composite operators don't quite line up)
|
||||
* - certain operators are used
|
||||
*/
|
||||
PRBool doUseIntermediateSurface = NeedToUseIntermediateSurface() ||
|
||||
NeedIntermediateSurfaceToHandleGlobalAlpha(style);
|
||||
PRBool doUseIntermediateSurface = NeedIntermediateSurfaceToHandleGlobalAlpha(style);
|
||||
|
||||
PRBool doDrawShadow = NeedToDrawShadow();
|
||||
|
||||
// Clear the surface if we need to simulate unbounded SOURCE operator
|
||||
ClearSurfaceForUnboundedSource();
|
||||
|
||||
if (doDrawShadow) {
|
||||
gfxMatrix matrix = mThebes->CurrentMatrix();
|
||||
mThebes->IdentityMatrix();
|
||||
|
@ -2295,7 +2273,10 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
// don't need to take care of these with stroke since Stroke() does that
|
||||
PRBool doDrawShadow = aOp == TEXT_DRAW_OPERATION_FILL && NeedToDrawShadow();
|
||||
PRBool doUseIntermediateSurface = aOp == TEXT_DRAW_OPERATION_FILL &&
|
||||
(NeedToUseIntermediateSurface() || NeedIntermediateSurfaceToHandleGlobalAlpha(STYLE_FILL));
|
||||
NeedIntermediateSurfaceToHandleGlobalAlpha(STYLE_FILL);
|
||||
|
||||
// Clear the surface if we need to simulate unbounded SOURCE operator
|
||||
ClearSurfaceForUnboundedSource();
|
||||
|
||||
nsCanvasBidiProcessor processor;
|
||||
|
||||
|
@ -3072,6 +3053,9 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
|
||||
pathSR.Save();
|
||||
|
||||
// Clear the surface if we need to simulate unbounded SOURCE operator
|
||||
ClearSurfaceForUnboundedSource();
|
||||
|
||||
{
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
mThebes->Translate(gfxPoint(dx, dy));
|
||||
|
@ -3095,23 +3079,10 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
}
|
||||
}
|
||||
|
||||
PRBool doUseIntermediateSurface = NeedToUseIntermediateSurface();
|
||||
|
||||
mThebes->SetPattern(pattern);
|
||||
DirtyAllStyles();
|
||||
|
||||
if (doUseIntermediateSurface) {
|
||||
// draw onto a pushed group
|
||||
mThebes->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
||||
mThebes->Clip(clip);
|
||||
|
||||
// don't want operators to be applied twice
|
||||
mThebes->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
|
||||
mThebes->Paint();
|
||||
mThebes->PopGroupToSource();
|
||||
} else
|
||||
mThebes->Clip(clip);
|
||||
mThebes->Clip(clip);
|
||||
|
||||
dirty = mThebes->UserToDevice(clip);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ function isPixel(ctx, x,y, r,g,b,a, d) {
|
|||
g-d <= pg && pg <= g+d &&
|
||||
b-d <= pb && pb <= b+d &&
|
||||
a-d <= pa && pa <= a+d,
|
||||
"pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d);
|
||||
"pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d);
|
||||
}
|
||||
|
||||
function test_2d_clearRect_basic() {
|
||||
|
@ -2197,7 +2197,7 @@ ctx.globalCompositeOperation = 'copy';
|
|||
ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
|
||||
ctx.translate(0, 25);
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
|
||||
|
||||
}
|
||||
|
@ -2330,8 +2330,8 @@ ctx.fillStyle = 'rgba(0, 255, 255, 0.5)';
|
|||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.drawImage(document.getElementById('yellow_1.png'), 40, 40, 10, 10, 40, 50, 10, 10);
|
||||
todo_isPixel(ctx, 15,15, 0,0,0,0, 5);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
isPixel(ctx, 15,15, 0,0,0,0, 5);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
|
||||
|
||||
}
|
||||
|
@ -2466,7 +2466,7 @@ ctx.fillRect(0, 0, 100, 50);
|
|||
ctx.globalCompositeOperation = 'copy';
|
||||
ctx.fillStyle = ctx.createPattern(document.getElementById('yellow_6.png'), 'no-repeat');
|
||||
ctx.fillRect(0, 50, 100, 50);
|
||||
todo_isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
isPixel(ctx, 50,25, 0,0,0,0, 5);
|
||||
|
||||
|
||||
}
|
||||
|
@ -21100,7 +21100,12 @@ function runTests() {
|
|||
//test_2d_composite_uncovered_pattern_source_out();
|
||||
|
||||
//test_2d_path_rect_zero_6(); // This test is bogus according to the spec; see bug 407107
|
||||
|
||||
|
||||
// These tests are bogus according to the spec: shadows should not be
|
||||
// drawn if shadowBlur, shadowOffsetX, and shadowOffsetY are all zero, whic
|
||||
// they are in these tests
|
||||
//test_2d_shadow_composite_3();
|
||||
//test_2d_shadow_composite_4();
|
||||
try {
|
||||
test_2d_canvas_readonly();
|
||||
} catch (e) {
|
||||
|
@ -23456,16 +23461,6 @@ function runTests() {
|
|||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_shadow_composite_2");
|
||||
}
|
||||
try {
|
||||
test_2d_shadow_composite_3();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_shadow_composite_3");
|
||||
}
|
||||
try {
|
||||
test_2d_shadow_composite_4();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_shadow_composite_4");
|
||||
}
|
||||
try {
|
||||
test_2d_shadow_gradient_alpha();
|
||||
} catch (e) {
|
||||
|
|
|
@ -115,6 +115,15 @@ nsContentEventHandler::Init(nsQueryContentEvent* aEvent)
|
|||
|
||||
nsINode* startNode = mFirstSelectedRange->GetStartParent();
|
||||
NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
|
||||
nsINode* endNode = mFirstSelectedRange->GetEndParent();
|
||||
NS_ENSURE_TRUE(endNode, NS_ERROR_FAILURE);
|
||||
|
||||
// See bug 537041 comment 5, the range could have removed node.
|
||||
NS_ENSURE_TRUE(startNode->GetCurrentDoc() == mPresShell->GetDocument(),
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
NS_ASSERTION(startNode->GetCurrentDoc() == endNode->GetCurrentDoc(),
|
||||
"mFirstSelectedRange crosses the document boundary");
|
||||
|
||||
mRootContent = startNode->GetSelectionRootContent(mPresShell);
|
||||
NS_ENSURE_TRUE(mRootContent, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@
|
|||
#include "nsIProperties.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -2751,13 +2750,11 @@ nsEventStateManager::GetParentScrollingView(nsInputEvent *aEvent,
|
|||
}
|
||||
|
||||
nsIPresShell *pPresShell = nsnull;
|
||||
nsPresShellIterator iter(parentDoc);
|
||||
nsCOMPtr<nsIPresShell> tmpPresShell;
|
||||
while ((tmpPresShell = iter.GetNextShell())) {
|
||||
nsIPresShell *tmpPresShell = parentDoc->GetPrimaryShell();
|
||||
if (tmpPresShell) {
|
||||
NS_ENSURE_TRUE(tmpPresShell->GetPresContext(), NS_ERROR_FAILURE);
|
||||
if (tmpPresShell->GetPresContext()->Type() == aPresContext->Type()) {
|
||||
pPresShell = tmpPresShell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!pPresShell)
|
||||
|
|
|
@ -1860,7 +1860,7 @@ void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged()
|
|||
mDecoder->Suspend();
|
||||
} else {
|
||||
mDecoder->Resume();
|
||||
if (IsPotentiallyPlaying()) {
|
||||
if (!mPaused && !mDecoder->IsEnded()) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,15 +276,10 @@ nsresult
|
|||
nsMediaDocument::StartLayout()
|
||||
{
|
||||
mMayStartLayout = PR_TRUE;
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
if (shell->DidInitialReflow()) {
|
||||
// Don't mess with this presshell: someone has already handled
|
||||
// its initial reflow.
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
// Don't mess with the presshell if someone has already handled
|
||||
// its initial reflow.
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
nsRect visibleArea = shell->GetPresContext()->GetVisibleArea();
|
||||
nsresult rv = shell->InitialReflow(visibleArea.width, visibleArea.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
@ -87,15 +86,11 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
aDocument->SetMathMLEnabled();
|
||||
aDocument->EnsureCatalogStyleSheet(kMathMLStyleSheetURI);
|
||||
|
||||
// Rebuild style data for all the presshells, because style system
|
||||
// Rebuild style data for the presshell, because style system
|
||||
// optimizations may have taken place assuming MathML was disabled.
|
||||
// (See nsRuleNode::CheckSpecifiedProperties.)
|
||||
// nsPresShellIterator skips hidden presshells, but that's OK because
|
||||
// if we're changing the document for one of those presshells the whole
|
||||
// presshell will be torn down.
|
||||
nsPresShellIterator iter(aDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell()) != nsnull) {
|
||||
nsCOMPtr<nsIPresShell> shell = aDocument->GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->GetPresContext()->PostRebuildAllStyleDataEvent(nsChangeHint(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" style="-moz-binding:url(#xbl)">
|
||||
<bindings xmlns="http://www.mozilla.org/xbl">
|
||||
<binding id="xbl" inheritstyle="false">
|
||||
<content>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<animate attributeName="font-size"/>
|
||||
</svg>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 294 B |
|
@ -3,3 +3,4 @@ load 525099-1.svg
|
|||
load 526875-1.svg
|
||||
load 526875-2.svg
|
||||
load 529387-1.xhtml
|
||||
load 537157-1.svg
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsStyleAnimation.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
static PRBool
|
||||
GetCSSComputedValue(nsIContent* aElem,
|
||||
|
@ -62,11 +62,18 @@ GetCSSComputedValue(nsIContent* aElem,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsPIDOMWindow* win = doc->GetWindow();
|
||||
NS_ABORT_IF_FALSE(win, "actively animated document w/ no window");
|
||||
nsRefPtr<nsComputedDOMStyle>
|
||||
computedStyle(win->LookupComputedStyleFor(aElem));
|
||||
if (computedStyle) {
|
||||
nsIPresShell* shell = doc->GetPrimaryShell();
|
||||
if (!shell) {
|
||||
NS_WARNING("Unable to look up computed style -- no pres shell");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsComputedDOMStyle> computedStyle;
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(aElem));
|
||||
nsresult rv = NS_NewComputedDOMStyle(domElement, EmptyString(), shell,
|
||||
getter_AddRefs(computedStyle));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && computedStyle) {
|
||||
// NOTE: This will produce an empty string for shorthand values
|
||||
computedStyle->GetPropertyValue(aPropID, aResult);
|
||||
return PR_TRUE;
|
||||
|
@ -199,17 +206,7 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
|
|||
// writing-mode
|
||||
|
||||
switch (aPropID) {
|
||||
// SHORTHAND PROPERTIES
|
||||
case eCSSProperty_font:
|
||||
case eCSSProperty_marker:
|
||||
case eCSSProperty_overflow:
|
||||
return PR_TRUE;
|
||||
|
||||
// PROPERTIES OF TYPE eCSSType_Rect
|
||||
case eCSSProperty_clip:
|
||||
// XXXdholbert Rect type not yet supported by nsStyleAnimation
|
||||
return PR_FALSE;
|
||||
|
||||
case eCSSProperty_clip_rule:
|
||||
case eCSSProperty_clip_path:
|
||||
case eCSSProperty_color:
|
||||
|
@ -224,6 +221,7 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
|
|||
case eCSSProperty_filter:
|
||||
case eCSSProperty_flood_color:
|
||||
case eCSSProperty_flood_opacity:
|
||||
case eCSSProperty_font:
|
||||
case eCSSProperty_font_family:
|
||||
case eCSSProperty_font_size:
|
||||
case eCSSProperty_font_size_adjust:
|
||||
|
@ -234,11 +232,13 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
|
|||
case eCSSProperty_image_rendering:
|
||||
case eCSSProperty_letter_spacing:
|
||||
case eCSSProperty_lighting_color:
|
||||
case eCSSProperty_marker:
|
||||
case eCSSProperty_marker_end:
|
||||
case eCSSProperty_marker_mid:
|
||||
case eCSSProperty_marker_start:
|
||||
case eCSSProperty_mask:
|
||||
case eCSSProperty_opacity:
|
||||
case eCSSProperty_overflow:
|
||||
case eCSSProperty_pointer_events:
|
||||
case eCSSProperty_shape_rendering:
|
||||
case eCSSProperty_stop_color:
|
||||
|
|
|
@ -87,6 +87,27 @@ var _fromByTestLists =
|
|||
// List of attribute/testcase-list bundles to be tested
|
||||
var gFromByBundles =
|
||||
[
|
||||
new TestcaseBundle(gPropList.clip, [
|
||||
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
|
||||
"rect(10px, 20px, 30px, 40px)",
|
||||
{ midComp: "rect(6px, 12px, 18px, 24px)",
|
||||
toComp: "rect(11px, 22px, 33px, 44px)"}),
|
||||
// Adding "auto" (either as a standalone value or a subcomponent value)
|
||||
// should cause animation to fail.
|
||||
new AnimTestcaseFromBy("auto", "auto", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("auto",
|
||||
"rect(auto, auto, auto, auto)", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("rect(auto, auto, auto, auto)",
|
||||
"rect(auto, auto, auto, auto)", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", "auto", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("auto", "rect(1px, 2px, 3px, 4px)", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("rect(1px, 2px, 3px, auto)",
|
||||
"rect(10px, 20px, 30px, 40px)", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("rect(1px, auto, 3px, 4px)",
|
||||
"rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
|
||||
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
|
||||
"rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
|
||||
]),
|
||||
// Check that 'by' animations for 'cursor' has no effect
|
||||
new TestcaseBundle(gPropList.cursor, [
|
||||
new AnimTestcaseFromBy("crosshair", "move"),
|
||||
|
|
|
@ -151,11 +151,23 @@ var _fromToTestLists = {
|
|||
// List of attribute/testcase-list bundles to be tested
|
||||
var gFromToBundles = [
|
||||
new TestcaseBundle(gPropList.clip, [
|
||||
// XXXdholbert Add more rect-valued testcases once we support rect values
|
||||
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
|
||||
"rect(11px, 22px, 33px, 44px)",
|
||||
{ midComp: "rect(6px, 12px, 18px, 24px)" }),
|
||||
], "need support for rect() values"),
|
||||
new AnimTestcaseFromTo("rect(1px, auto, 3px, 4px)",
|
||||
"rect(11px, auto, 33px, 44px)",
|
||||
{ midComp: "rect(6px, auto, 18px, 24px)" }),
|
||||
new AnimTestcaseFromTo("auto", "auto"),
|
||||
new AnimTestcaseFromTo("rect(auto, auto, auto, auto)",
|
||||
"rect(auto, auto, auto, auto)"),
|
||||
// Interpolation not supported in these next cases (with auto --> px-value)
|
||||
new AnimTestcaseFromTo("rect(1px, auto, 3px, auto)",
|
||||
"rect(11px, auto, 33px, 44px)"),
|
||||
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
|
||||
"rect(11px, auto, 33px, 44px)"),
|
||||
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)", "auto"),
|
||||
new AnimTestcaseFromTo("auto", "rect(1px, 2px, 3px, 4px)"),
|
||||
]),
|
||||
new TestcaseBundle(gPropList.clip_path, _fromToTestLists.URIsAndNone),
|
||||
new TestcaseBundle(gPropList.clip_rule, [
|
||||
new AnimTestcaseFromTo("nonzero", "evenodd"),
|
||||
|
|
|
@ -163,16 +163,58 @@ var _pacedTestLists =
|
|||
comp2_3: "rect(20px, 20px, 90px, 6px)",
|
||||
comp1: "rect(20px, 30px, 130px, 4px)"
|
||||
}),
|
||||
// XXXdholbert Test "inherit" & "auto" as rect values, & test "auto" as
|
||||
// a component value
|
||||
new AnimTestcasePaced("rect(10px, auto, 10px, 10px); " +
|
||||
"rect(20px, auto, 50px, 8px); " +
|
||||
"rect(40px, auto, 130px, 4px)",
|
||||
{ comp0: "rect(10px, auto, 10px, 10px)",
|
||||
comp1_6: "rect(15px, auto, 30px, 9px)",
|
||||
comp1_3: "rect(20px, auto, 50px, 8px)",
|
||||
comp2_3: "rect(30px, auto, 90px, 6px)",
|
||||
comp1: "rect(40px, auto, 130px, 4px)"
|
||||
}),
|
||||
// Paced-mode animation is not supported in these next few cases
|
||||
// (Can't compute subcomponent distance between 'auto' & px-values)
|
||||
new AnimTestcasePaced("rect(10px, 10px, 10px, auto); " +
|
||||
"rect(20px, 10px, 50px, 8px); " +
|
||||
"rect(20px, 30px, 130px, 4px)",
|
||||
{ comp0: "rect(10px, 10px, 10px, auto)",
|
||||
comp1_6: "rect(10px, 10px, 10px, auto)",
|
||||
comp1_3: "rect(20px, 10px, 50px, 8px)",
|
||||
comp2_3: "rect(20px, 30px, 130px, 4px)",
|
||||
comp1: "rect(20px, 30px, 130px, 4px)"
|
||||
}),
|
||||
new AnimTestcasePaced("rect(10px, 10px, 10px, 10px); " +
|
||||
"rect(20px, 10px, 50px, 8px); " +
|
||||
"auto",
|
||||
{ comp0: "rect(10px, 10px, 10px, 10px)",
|
||||
comp1_6: "rect(10px, 10px, 10px, 10px)",
|
||||
comp1_3: "rect(20px, 10px, 50px, 8px)",
|
||||
comp2_3: "auto",
|
||||
comp1: "auto"
|
||||
}),
|
||||
new AnimTestcasePaced("auto; " +
|
||||
"auto; " +
|
||||
"rect(20px, 30px, 130px, 4px)",
|
||||
{ comp0: "auto",
|
||||
comp1_6: "auto",
|
||||
comp1_3: "auto",
|
||||
comp2_3: "rect(20px, 30px, 130px, 4px)",
|
||||
comp1: "rect(20px, 30px, 130px, 4px)"
|
||||
}),
|
||||
new AnimTestcasePaced("auto; auto; auto",
|
||||
{ comp0: "auto",
|
||||
comp1_6: "auto",
|
||||
comp1_3: "auto",
|
||||
comp2_3: "auto",
|
||||
comp1: "auto"
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
// TODO: test more properties here.
|
||||
var gPacedBundles =
|
||||
[
|
||||
new TestcaseBundle(gPropList.clip, _pacedTestLists.rect,
|
||||
"need support for animating rect-valued properties"),
|
||||
new TestcaseBundle(gPropList.clip, _pacedTestLists.rect),
|
||||
new TestcaseBundle(gPropList.color, _pacedTestLists.color),
|
||||
new TestcaseBundle(gPropList.direction, [
|
||||
new AnimTestcasePaced("rtl; ltr; rtl")
|
||||
|
|
|
@ -83,7 +83,6 @@ protected:
|
|||
// mChannel is also cancelled. Note that if this member is true, mChannel
|
||||
// cannot be null.
|
||||
PRPackedBool mChannelIsPending;
|
||||
PRPackedBool mLoadedAsInteractiveData;
|
||||
PRPackedBool mAsync;
|
||||
PRPackedBool mLoopingForSyncLoad;
|
||||
};
|
||||
|
|
|
@ -67,14 +67,14 @@ txHandlerTable* gTxImportHandler = 0;
|
|||
txHandlerTable* gTxAttributeSetHandler = 0;
|
||||
txHandlerTable* gTxFallbackHandler = 0;
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartLRE(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
txStylesheetCompilerState& aState);
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndLRE(txStylesheetCompilerState& aState);
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ txFnEndLRE(txStylesheetCompilerState& aState);
|
|||
} while(0)
|
||||
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getStyleAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
PRInt32 aNamespace,
|
||||
|
@ -116,7 +116,7 @@ getStyleAttr(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
parseUseAttrSets(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
PRBool aInXSLTNS,
|
||||
|
@ -148,7 +148,7 @@ parseUseAttrSets(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
parseExcludeResultPrefixes(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
PRInt32 aNamespaceID)
|
||||
|
@ -166,7 +166,7 @@ parseExcludeResultPrefixes(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getQNameAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -192,7 +192,7 @@ getQNameAttr(txStylesheetAttr* aAttributes,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getExprAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -229,7 +229,7 @@ getExprAttr(txStylesheetAttr* aAttributes,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getAVTAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -266,7 +266,7 @@ getAVTAttr(txStylesheetAttr* aAttributes,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getPatternAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -291,7 +291,7 @@ getPatternAttr(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getNumberAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -316,7 +316,7 @@ getNumberAttr(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getAtomAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -338,7 +338,7 @@ getAtomAttr(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getYesNoAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -368,7 +368,7 @@ getYesNoAttr(txStylesheetAttr* aAttributes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getCharAttr(txStylesheetAttr* aAttributes,
|
||||
PRInt32 aAttrCount,
|
||||
nsIAtom* aName,
|
||||
|
@ -399,13 +399,13 @@ getCharAttr(txStylesheetAttr* aAttributes,
|
|||
/**
|
||||
* Ignore and error handlers
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextIgnore(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextError(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
TX_RETURN_IF_WHITESPACE(aStr, aState);
|
||||
|
@ -423,7 +423,7 @@ clearAttributes(txStylesheetAttr* aAttributes,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementIgnore(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -438,13 +438,13 @@ txFnStartElementIgnore(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndElementIgnore(txStylesheetCompilerState& aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementSetIgnore(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -459,14 +459,14 @@ txFnStartElementSetIgnore(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndElementSetIgnore(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementError(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -477,7 +477,7 @@ txFnStartElementError(PRInt32 aNamespaceID,
|
|||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndElementError(txStylesheetCompilerState& aState)
|
||||
{
|
||||
NS_ERROR("txFnEndElementError shouldn't be called");
|
||||
|
@ -488,7 +488,7 @@ txFnEndElementError(txStylesheetCompilerState& aState)
|
|||
/**
|
||||
* Root handlers
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartStylesheet(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -514,14 +514,14 @@ txFnStartStylesheet(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxImportHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndStylesheet(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementContinueTopLevel(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -534,7 +534,7 @@ txFnStartElementContinueTopLevel(PRInt32 aNamespaceID,
|
|||
return NS_XSLT_GET_NEW_HANDLER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartLREStylesheet(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -570,7 +570,7 @@ txFnStartLREStylesheet(PRInt32 aNamespaceID,
|
|||
aAttrCount, aState);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndLREStylesheet(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsresult rv = txFnEndLRE(aState);
|
||||
|
@ -589,7 +589,7 @@ txFnEndLREStylesheet(txStylesheetCompilerState& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartEmbed(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -609,7 +609,7 @@ txFnStartEmbed(PRInt32 aNamespaceID,
|
|||
aAttributes, aAttrCount, aState);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndEmbed(txStylesheetCompilerState& aState)
|
||||
{
|
||||
if (!aState.handleEmbeddedSheet()) {
|
||||
|
@ -624,7 +624,7 @@ txFnEndEmbed(txStylesheetCompilerState& aState)
|
|||
/**
|
||||
* Top handlers
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartOtherTop(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -640,7 +640,7 @@ txFnStartOtherTop(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndOtherTop(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -649,7 +649,7 @@ txFnEndOtherTop(txStylesheetCompilerState& aState)
|
|||
|
||||
|
||||
// xsl:attribute-set
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartAttributeSet(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -679,7 +679,7 @@ txFnStartAttributeSet(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxAttributeSetHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndAttributeSet(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -697,7 +697,7 @@ txFnEndAttributeSet(txStylesheetCompilerState& aState)
|
|||
|
||||
|
||||
// xsl:decimal-format
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartDecimalFormat(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -769,7 +769,7 @@ txFnStartDecimalFormat(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndDecimalFormat(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -778,7 +778,7 @@ txFnEndDecimalFormat(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:import
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartImport(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -811,7 +811,7 @@ txFnStartImport(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndImport(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -820,7 +820,7 @@ txFnEndImport(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:include
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartInclude(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -842,7 +842,7 @@ txFnStartInclude(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndInclude(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -851,7 +851,7 @@ txFnEndInclude(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:key
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartKey(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -881,7 +881,7 @@ txFnStartKey(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndKey(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -890,7 +890,7 @@ txFnEndKey(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:namespace-alias
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartNamespaceAlias(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -912,7 +912,7 @@ txFnStartNamespaceAlias(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndNamespaceAlias(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -921,7 +921,7 @@ txFnEndNamespaceAlias(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:output
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartOutput(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1029,7 +1029,7 @@ txFnStartOutput(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndOutput(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1038,7 +1038,7 @@ txFnEndOutput(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:strip-space/xsl:preserve-space
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartStripSpace(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1112,7 +1112,7 @@ txFnStartStripSpace(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndStripSpace(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1121,7 +1121,7 @@ txFnEndStripSpace(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:template
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartTemplate(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1162,7 +1162,7 @@ txFnStartTemplate(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxParamHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndTemplate(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1179,7 +1179,7 @@ txFnEndTemplate(txStylesheetCompilerState& aState)
|
|||
}
|
||||
|
||||
// xsl:variable, xsl:param
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartTopVariable(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1224,7 +1224,7 @@ txFnStartTopVariable(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndTopVariable(txStylesheetCompilerState& aState)
|
||||
{
|
||||
txHandlerTable* prev = aState.mHandlerTable;
|
||||
|
@ -1252,7 +1252,7 @@ txFnEndTopVariable(txStylesheetCompilerState& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementStartTopVar(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1265,7 +1265,7 @@ txFnStartElementStartTopVar(PRInt32 aNamespaceID,
|
|||
return NS_XSLT_GET_NEW_HANDLER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextStartTopVar(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
TX_RETURN_IF_WHITESPACE(aStr, aState);
|
||||
|
@ -1288,7 +1288,7 @@ txFnTextStartTopVar(const nsAString& aStr, txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txEndElement
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartLRE(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1340,7 +1340,7 @@ txFnStartLRE(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndLRE(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(new txEndElement);
|
||||
|
@ -1357,7 +1357,7 @@ txFnEndLRE(txStylesheetCompilerState& aState)
|
|||
|
||||
txText
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnText(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
TX_RETURN_IF_WHITESPACE(aStr, aState);
|
||||
|
@ -1377,7 +1377,7 @@ txFnText(const nsAString& aStr, txStylesheetCompilerState& aState)
|
|||
txApplyImportsStart
|
||||
txApplyImportsEnd
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartApplyImports(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1402,7 +1402,7 @@ txFnStartApplyImports(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndApplyImports(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1420,7 +1420,7 @@ txFnEndApplyImports(txStylesheetCompilerState& aState)
|
|||
txLoopNodeSet -+ |
|
||||
txPopParams <-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartApplyTemplates(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1479,7 +1479,7 @@ txFnStartApplyTemplates(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxApplyTemplatesHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndApplyTemplates(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1520,7 +1520,7 @@ txFnEndApplyTemplates(txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txAttribute
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartAttribute(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1559,7 +1559,7 @@ txFnStartAttribute(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxTemplateHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndAttribute(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1579,7 +1579,7 @@ txFnEndAttribute(txStylesheetCompilerState& aState)
|
|||
txCallTemplate
|
||||
txPopParams
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartCallTemplate(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1611,7 +1611,7 @@ txFnStartCallTemplate(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxCallTemplateHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndCallTemplate(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1644,7 +1644,7 @@ txFnEndCallTemplate(txStylesheetCompilerState& aState)
|
|||
[children] | <-+ for the xsl:otherwise, if there is one
|
||||
<-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartChoose(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1658,7 +1658,7 @@ txFnStartChoose(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxChooseHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndChoose(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1682,7 +1682,7 @@ txFnEndChoose(txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txComment
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartComment(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1699,7 +1699,7 @@ txFnStartComment(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndComment(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(new txComment);
|
||||
|
@ -1720,7 +1720,7 @@ txFnEndComment(txStylesheetCompilerState& aState)
|
|||
txEndElement |
|
||||
<-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartCopy(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1744,7 +1744,7 @@ txFnStartCopy(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndCopy(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(new txEndElement);
|
||||
|
@ -1765,7 +1765,7 @@ txFnEndCopy(txStylesheetCompilerState& aState)
|
|||
|
||||
txCopyOf
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartCopyOf(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1789,7 +1789,7 @@ txFnStartCopyOf(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndCopyOf(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1804,7 +1804,7 @@ txFnEndCopyOf(txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txEndElement
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElement(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1837,7 +1837,7 @@ txFnStartElement(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndElement(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(new txEndElement);
|
||||
|
@ -1854,7 +1854,7 @@ txFnEndElement(txStylesheetCompilerState& aState)
|
|||
|
||||
[children]
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartFallback(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1867,7 +1867,7 @@ txFnStartFallback(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxTemplateHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndFallback(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1886,7 +1886,7 @@ txFnEndFallback(txStylesheetCompilerState& aState)
|
|||
txLoopNodeSet -+ |
|
||||
<-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartForEach(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1926,7 +1926,7 @@ txFnStartForEach(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxForEachHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndForEach(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -1947,7 +1947,7 @@ txFnEndForEach(txStylesheetCompilerState& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementContinueTemplate(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -1960,7 +1960,7 @@ txFnStartElementContinueTemplate(PRInt32 aNamespaceID,
|
|||
return NS_XSLT_GET_NEW_HANDLER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextContinueTemplate(const nsAString& aStr,
|
||||
txStylesheetCompilerState& aState)
|
||||
{
|
||||
|
@ -1978,7 +1978,7 @@ txFnTextContinueTemplate(const nsAString& aStr,
|
|||
[children] |
|
||||
<-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartIf(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2006,7 +2006,7 @@ txFnStartIf(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndIf(txStylesheetCompilerState& aState)
|
||||
{
|
||||
txConditionalGoto* condGoto =
|
||||
|
@ -2021,7 +2021,7 @@ txFnEndIf(txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txMessage
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartMessage(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2051,7 +2051,7 @@ txFnStartMessage(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndMessage(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>(aState.popObject()));
|
||||
|
@ -2066,7 +2066,7 @@ txFnEndMessage(txStylesheetCompilerState& aState)
|
|||
|
||||
txNumber
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartNumber(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2143,7 +2143,7 @@ txFnStartNumber(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndNumber(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -2156,7 +2156,7 @@ txFnEndNumber(txStylesheetCompilerState& aState)
|
|||
|
||||
(see xsl:choose)
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartOtherwise(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2167,7 +2167,7 @@ txFnStartOtherwise(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxTemplateHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndOtherwise(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -2185,7 +2185,7 @@ txFnEndOtherwise(txStylesheetCompilerState& aState)
|
|||
txSetVariable |
|
||||
<-+
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartParam(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2236,7 +2236,7 @@ txFnStartParam(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndParam(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txSetVariable> var(static_cast<txSetVariable*>
|
||||
|
@ -2272,7 +2272,7 @@ txFnEndParam(txStylesheetCompilerState& aState)
|
|||
[children]
|
||||
txProcessingInstruction
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartPI(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2302,7 +2302,7 @@ txFnStartPI(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndPI(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>
|
||||
|
@ -2318,7 +2318,7 @@ txFnEndPI(txStylesheetCompilerState& aState)
|
|||
|
||||
(no instructions)
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartSort(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2370,7 +2370,7 @@ txFnStartSort(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndSort(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -2383,7 +2383,7 @@ txFnEndSort(txStylesheetCompilerState& aState)
|
|||
|
||||
[children] (only txText)
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartText(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2405,7 +2405,7 @@ txFnStartText(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxTextHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndText(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.mDOE = MB_FALSE;
|
||||
|
@ -2413,7 +2413,7 @@ txFnEndText(txStylesheetCompilerState& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextText(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txInstruction> instr(new txText(aStr, aState.mDOE));
|
||||
|
@ -2430,7 +2430,7 @@ txFnTextText(const nsAString& aStr, txStylesheetCompilerState& aState)
|
|||
|
||||
txValueOf
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartValueOf(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2460,7 +2460,7 @@ txFnStartValueOf(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxIgnoreHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndValueOf(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -2474,7 +2474,7 @@ txFnEndValueOf(txStylesheetCompilerState& aState)
|
|||
[children] /
|
||||
txSetVariable
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartVariable(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2515,7 +2515,7 @@ txFnStartVariable(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndVariable(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txSetVariable> var(static_cast<txSetVariable*>
|
||||
|
@ -2542,7 +2542,7 @@ txFnEndVariable(txStylesheetCompilerState& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartElementStartRTF(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2561,7 +2561,7 @@ txFnStartElementStartRTF(PRInt32 aNamespaceID,
|
|||
return NS_XSLT_GET_NEW_HANDLER;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnTextStartRTF(const nsAString& aStr, txStylesheetCompilerState& aState)
|
||||
{
|
||||
TX_RETURN_IF_WHITESPACE(aStr, aState);
|
||||
|
@ -2582,7 +2582,7 @@ txFnTextStartRTF(const nsAString& aStr, txStylesheetCompilerState& aState)
|
|||
|
||||
(see xsl:choose)
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartWhen(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2610,7 +2610,7 @@ txFnStartWhen(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxTemplateHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndWhen(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
@ -2639,7 +2639,7 @@ txFnEndWhen(txStylesheetCompilerState& aState)
|
|||
[children] /
|
||||
txSetParam
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartWithParam(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2680,7 +2680,7 @@ txFnStartWithParam(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndWithParam(txStylesheetCompilerState& aState)
|
||||
{
|
||||
nsAutoPtr<txSetParam> var(static_cast<txSetParam*>(aState.popObject()));
|
||||
|
@ -2709,7 +2709,7 @@ txFnEndWithParam(txStylesheetCompilerState& aState)
|
|||
or
|
||||
txErrorInstruction otherwise
|
||||
*/
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnStartUnknownInstruction(PRInt32 aNamespaceID,
|
||||
nsIAtom* aLocalName,
|
||||
nsIAtom* aPrefix,
|
||||
|
@ -2729,7 +2729,7 @@ txFnStartUnknownInstruction(PRInt32 aNamespaceID,
|
|||
return aState.pushHandlerTable(gTxFallbackHandler);
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
txFnEndUnknownInstruction(txStylesheetCompilerState& aState)
|
||||
{
|
||||
aState.popHandlerTable();
|
||||
|
|
|
@ -151,7 +151,6 @@
|
|||
#include "nsNodeInfoManager.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
|
@ -2119,9 +2118,8 @@ nsXULElement::Click()
|
|||
|
||||
nsCOMPtr<nsIDocument> doc = GetCurrentDoc(); // Strong just in case
|
||||
if (doc) {
|
||||
nsPresShellIterator iter(doc);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
// strong ref to PresContext so events don't destroy it
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresShellIterator.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gLog;
|
||||
|
@ -437,9 +436,8 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
|||
}
|
||||
#endif
|
||||
|
||||
nsPresShellIterator iter(document);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = document->GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
|
|
@ -949,9 +949,8 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
|
|||
// |onbroadcast| event handler
|
||||
nsEvent event(PR_TRUE, NS_XUL_BROADCAST);
|
||||
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
|
@ -2018,9 +2017,8 @@ nsXULDocument::Init()
|
|||
nsresult
|
||||
nsXULDocument::StartLayout(void)
|
||||
{
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
|
||||
// Resize-reflow this time
|
||||
nsPresContext *cx = shell->GetPresContext();
|
||||
|
@ -2064,9 +2062,6 @@ nsXULDocument::StartLayout(void)
|
|||
// above can flush reflows, which can cause a parent document to be flushed,
|
||||
// calling ResizeReflow on our document which does SetVisibleArea.
|
||||
nsRect r = cx->GetVisibleArea();
|
||||
// Make sure we're holding a strong ref to |shell| before we call
|
||||
// InitialReflow()
|
||||
nsCOMPtr<nsIPresShell> shellGrip = shell;
|
||||
rv = shell->InitialReflow(r.width, r.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
This is sqlite 3.6.20
|
||||
This is sqlite 3.6.22
|
||||
|
||||
-- Shawn Wilsher <me@shawnwilsher.com>, 11/2009
|
||||
-- Shawn Wilsher <me@shawnwilsher.com>, 01/2010
|
||||
|
||||
See http://www.sqlite.org/ for more info.
|
||||
|
||||
|
|
20885
db/sqlite3/src/sqlite3.c
20885
db/sqlite3/src/sqlite3.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -64,6 +64,7 @@ struct RedirEntry {
|
|||
URI. Perhaps we should separate the two concepts out...
|
||||
*/
|
||||
static RedirEntry kRedirMap[] = {
|
||||
{ "about", "chrome://global/content/aboutAbout.xhtml", 0 },
|
||||
{ "credits", "http://www.mozilla.org/credits/",
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
|
||||
{ "mozilla", "chrome://global/content/mozilla.xhtml",
|
||||
|
|
|
@ -152,6 +152,11 @@ static const nsModuleComponentInfo gDocShellModuleInfo[] = {
|
|||
},
|
||||
|
||||
// about redirector
|
||||
{ "about:about",
|
||||
NS_ABOUT_REDIRECTOR_MODULE_CID,
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "about",
|
||||
nsAboutRedirector::Create
|
||||
},
|
||||
{ "about:config",
|
||||
NS_ABOUT_REDIRECTOR_MODULE_CID,
|
||||
NS_ABOUT_MODULE_CONTRACTID_PREFIX "config",
|
||||
|
|
|
@ -246,7 +246,7 @@ nsSHEntry::SetContentViewer(nsIContentViewer *aViewer)
|
|||
// the contentviewer
|
||||
mDocument = do_QueryInterface(domDoc);
|
||||
if (mDocument) {
|
||||
mDocument->SetShellsHidden(PR_TRUE);
|
||||
mDocument->SetShellHidden(PR_TRUE);
|
||||
mDocument->AddMutationObserver(this);
|
||||
}
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ nsSHEntry::DropPresentationState()
|
|||
nsRefPtr<nsSHEntry> kungFuDeathGrip = this;
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->SetShellsHidden(PR_FALSE);
|
||||
mDocument->SetShellHidden(PR_FALSE);
|
||||
mDocument->RemoveMutationObserver(this);
|
||||
mDocument = nsnull;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ var gTests = [
|
|||
},
|
||||
{ "name" : "iframes.html loaded from view-source jar type, pref disabled",
|
||||
"url" : "jar:view-source:http://localhost:8888/tests/docshell/test/bug369814.jar!/iframes.html",
|
||||
"pref" : true,
|
||||
"pref" : false,
|
||||
"pokes" : { },
|
||||
"func" : loadErrorTest
|
||||
},
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMCrypto.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
|
@ -1419,16 +1418,6 @@ nsGlobalWindow::WouldReuseInnerWindow(nsIDocument *aNewDocument)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
already_AddRefed<nsComputedDOMStyle>
|
||||
nsGlobalWindow::LookupComputedStyleFor(nsIContent* aElem)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(aElem));
|
||||
nsRefPtr<nsComputedDOMStyle> computedDOMStyle;
|
||||
GetComputedStyle(domElement, EmptyString(),
|
||||
getter_AddRefs(computedDOMStyle));
|
||||
return computedDOMStyle.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
|
@ -7043,12 +7032,14 @@ nsGlobalWindow::UpdateCanvasFocus(PRBool aFocusChanged, nsIContent* aNewContent)
|
|||
// nsGlobalWindow::nsIDOMViewCSS
|
||||
//*****************************************************************************
|
||||
|
||||
// Helper method for below
|
||||
nsresult
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
|
||||
const nsAString& aPseudoElt,
|
||||
nsComputedDOMStyle** aReturn)
|
||||
nsIDOMCSSStyleDeclaration** aReturn)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetComputedStyle, (aElt, aPseudoElt, aReturn),
|
||||
NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
|
@ -7067,18 +7058,9 @@ nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NewComputedDOMStyle(aElt, aPseudoElt, presShell,
|
||||
aReturn);
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
|
||||
const nsAString& aPseudoElt,
|
||||
nsIDOMCSSStyleDeclaration** aReturn)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetComputedStyle, (aElt, aPseudoElt, aReturn),
|
||||
NS_ERROR_NOT_INITIALIZED);
|
||||
nsRefPtr<nsComputedDOMStyle> compStyle;
|
||||
nsresult rv = GetComputedStyle(aElt, aPseudoElt, getter_AddRefs(compStyle));
|
||||
nsresult rv = NS_NewComputedDOMStyle(aElt, aPseudoElt, presShell,
|
||||
getter_AddRefs(compStyle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aReturn = compStyle.forget().get();
|
||||
|
@ -8479,6 +8461,7 @@ nsGlobalWindow::TimerCallback(nsITimer *aTimer, void *aClosure)
|
|||
//*****************************************************************************
|
||||
// nsGlobalWindow: Helper Functions
|
||||
//*****************************************************************************
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::GetTreeOwner(nsIDocShellTreeOwner **aTreeOwner)
|
||||
{
|
||||
|
|
|
@ -290,9 +290,6 @@ public:
|
|||
virtual NS_HIDDEN_(void) SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler);
|
||||
virtual NS_HIDDEN_(nsIFocusController*) GetRootFocusController();
|
||||
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsComputedDOMStyle>)
|
||||
LookupComputedStyleFor(nsIContent* aElem);
|
||||
|
||||
virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
|
||||
virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
|
||||
|
||||
|
@ -643,11 +640,6 @@ protected:
|
|||
return aList != &mTimeouts;
|
||||
}
|
||||
|
||||
// Helper method for looking up computed style
|
||||
nsresult GetComputedStyle(nsIDOMElement* aElt,
|
||||
const nsAString& aPseudoElt,
|
||||
nsComputedDOMStyle** aReturn);
|
||||
|
||||
// Convenience functions for the many methods that need to scale
|
||||
// from device to CSS pixels or vice versa. Note: if a presentation
|
||||
// context is not available, they will assume a 1:1 ratio.
|
||||
|
|
|
@ -53,8 +53,6 @@
|
|||
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
|
||||
|
||||
class nsIPrincipal;
|
||||
class nsICSSDeclaration;
|
||||
class nsComputedDOMStyle;
|
||||
|
||||
// Popup control state enum. The values in this enum must go from most
|
||||
// permissive to least permissive so that it's safe to push state in
|
||||
|
@ -80,8 +78,8 @@ class nsXBLPrototypeHandler;
|
|||
class nsIArray;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x70c9f57f, 0xf7b3, 0x4a37, \
|
||||
{ 0xbe, 0x36, 0xbb, 0xb2, 0xd7, 0xe9, 0x40, 0x13 } }
|
||||
{ 0xeee92d9a, 0xae9f, 0x41e5, \
|
||||
{ 0x95, 0x5f, 0xaf, 0x1c, 0xe7, 0x66, 0x42, 0xe6 } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
|
@ -251,10 +249,6 @@ public:
|
|||
return win->mIsHandlingResizeEvent;
|
||||
}
|
||||
|
||||
// Convenience method for getting an element's computed style
|
||||
virtual already_AddRefed<nsComputedDOMStyle>
|
||||
LookupComputedStyleFor(nsIContent* aElem) = 0;
|
||||
|
||||
// Tell this window who opened it. This only has an effect if there is
|
||||
// either no document currently in the window or if the document is the
|
||||
// original document this window came with (an about:blank document either
|
||||
|
|
|
@ -1056,8 +1056,8 @@ PluginInstanceChild::NPN_NewStream(NPMIMEType aMIMEType, const char* aWindow,
|
|||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceChild::InternalInvalidateRect(NPRect* aInvalidRect)
|
||||
void
|
||||
PluginInstanceChild::InvalidateRect(NPRect* aInvalidRect)
|
||||
{
|
||||
NS_ASSERTION(aInvalidRect, "Null pointer!");
|
||||
|
||||
|
@ -1067,14 +1067,10 @@ PluginInstanceChild::InternalInvalidateRect(NPRect* aInvalidRect)
|
|||
NS_ASSERTION(IsWindow(mPluginWindowHWND), "Bad window?!");
|
||||
RECT rect = { aInvalidRect->left, aInvalidRect->top,
|
||||
aInvalidRect->right, aInvalidRect->bottom };
|
||||
InvalidateRect(mPluginWindowHWND, &rect, FALSE);
|
||||
return false;
|
||||
::InvalidateRect(mPluginWindowHWND, &rect, FALSE);
|
||||
return;
|
||||
}
|
||||
// Windowless need the invalidation to propegate to parent
|
||||
// triggering wm_paint handle event calls.
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// Windowless plugins must return true!
|
||||
return false;
|
||||
SendNPN_InvalidateRect(*aInvalidRect);
|
||||
}
|
||||
|
|
|
@ -156,10 +156,7 @@ public:
|
|||
NPN_NewStream(NPMIMEType aMIMEType, const char* aWindow,
|
||||
NPStream** aStream);
|
||||
|
||||
// Return true if you want to send the notification to the parent process
|
||||
// also.
|
||||
bool
|
||||
InternalInvalidateRect(NPRect* aInvalidRect);
|
||||
void InvalidateRect(NPRect* aInvalidRect);
|
||||
|
||||
bool NotifyStream(StreamNotifyChild* notifyData, NPReason reason);
|
||||
|
||||
|
|
|
@ -799,13 +799,7 @@ _invalidaterect(NPP aNPP,
|
|||
{
|
||||
_MOZ_LOG(__FUNCTION__);
|
||||
AssertPluginThread();
|
||||
|
||||
PluginInstanceChild* actor = InstCast(aNPP);
|
||||
bool sendToParent = actor->InternalInvalidateRect(aInvalidRect);
|
||||
|
||||
if (sendToParent) {
|
||||
actor->SendNPN_InvalidateRect(*aInvalidRect);
|
||||
}
|
||||
InstCast(aNPP)->InvalidateRect(aInvalidRect);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
|
|
|
@ -22,8 +22,15 @@ ifdef GNU_CC
|
|||
SSE2_FLAGS=-msse2
|
||||
else
|
||||
ifeq ($(SOLARIS_SUNPRO_CC),1)
|
||||
ifneq (64,$(findstring 64,$(OS_TEST)))
|
||||
SSE1_FLAGS=-xarch=sse
|
||||
SSE2_FLAGS=-xarch=sse2
|
||||
else
|
||||
# Sun Studio doesn't work correctly for x86 intristics
|
||||
# with -m64 and without optimization.
|
||||
SSE1_FLAGS= -xO4
|
||||
SSE2_FLAGS= -xO4
|
||||
endif
|
||||
else
|
||||
SSE1_FLAGS=
|
||||
SSE2_FLAGS=
|
||||
|
|
|
@ -204,12 +204,12 @@ protected: // new functions
|
|||
PRBool mEnableKerning;
|
||||
|
||||
void GetPrefFonts(const char *aLangGroup,
|
||||
nsTArray<nsRefPtr<FontEntry> >& aFontEntryList);
|
||||
void GetCJKPrefFonts(nsTArray<nsRefPtr<FontEntry> >& aFontEntryList);
|
||||
nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
|
||||
void GetCJKPrefFonts(nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
|
||||
void FamilyListToArrayList(const nsString& aFamilies,
|
||||
const nsCString& aLangGroup,
|
||||
nsTArray<nsRefPtr<FontEntry> > *aFontEntryList);
|
||||
already_AddRefed<gfxFT2Font> WhichFontSupportsChar(const nsTArray<nsRefPtr<FontEntry> >& aFontEntryList,
|
||||
nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList);
|
||||
already_AddRefed<gfxFT2Font> WhichFontSupportsChar(const nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList,
|
||||
PRUint32 aCh);
|
||||
already_AddRefed<gfxFont> WhichPrefFontSupportsChar(PRUint32 aCh);
|
||||
already_AddRefed<gfxFont> WhichSystemFontSupportsChar(PRUint32 aCh);
|
||||
|
|
|
@ -165,6 +165,7 @@ public:
|
|||
mIsProxy(PR_FALSE), mIsValid(PR_TRUE),
|
||||
mIsBadUnderlineFont(PR_FALSE), mIsUserFont(PR_FALSE),
|
||||
mStandardFace(aIsStandardFace),
|
||||
mSymbolFont(PR_FALSE),
|
||||
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
|
||||
mCmapInitialized(PR_FALSE), mUserFontData(nsnull),
|
||||
mFamily(aFamily)
|
||||
|
@ -176,6 +177,7 @@ public:
|
|||
mIsValid(aEntry.mIsValid), mIsBadUnderlineFont(aEntry.mIsBadUnderlineFont),
|
||||
mIsUserFont(aEntry.mIsUserFont),
|
||||
mStandardFace(aEntry.mStandardFace),
|
||||
mSymbolFont(aEntry.mSymbolFont),
|
||||
mWeight(aEntry.mWeight), mCmapInitialized(aEntry.mCmapInitialized),
|
||||
mCharacterMap(aEntry.mCharacterMap), mUserFontData(aEntry.mUserFontData),
|
||||
mFamily(aEntry.mFamily)
|
||||
|
@ -186,13 +188,14 @@ public:
|
|||
// unique name for the face, *not* the family
|
||||
const nsString& Name() const { return mName; }
|
||||
|
||||
PRUint16 Weight() { return mWeight; }
|
||||
PRInt16 Stretch() { return mStretch; }
|
||||
PRUint16 Weight() const { return mWeight; }
|
||||
PRInt16 Stretch() const { return mStretch; }
|
||||
|
||||
PRBool IsUserFont() { return mIsUserFont; }
|
||||
PRBool IsFixedPitch() { return mFixedPitch; }
|
||||
PRBool IsItalic() { return mItalic; }
|
||||
PRBool IsBold() { return mWeight >= 600; } // bold == weights 600 and above
|
||||
PRBool IsUserFont() const { return mIsUserFont; }
|
||||
PRBool IsFixedPitch() const { return mFixedPitch; }
|
||||
PRBool IsItalic() const { return mItalic; }
|
||||
PRBool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
|
||||
PRBool IsSymbolFont() const { return mSymbolFont; }
|
||||
|
||||
inline PRBool HasCharacter(PRUint32 ch) {
|
||||
if (mCharacterMap.test(ch))
|
||||
|
@ -204,6 +207,13 @@ public:
|
|||
virtual PRBool TestCharacterMap(PRUint32 aCh);
|
||||
virtual nsresult ReadCMAP();
|
||||
|
||||
virtual PRBool MatchesGenericFamily(const nsACString& aGeneric) const {
|
||||
return PR_TRUE;
|
||||
}
|
||||
virtual PRBool SupportsLangGroup(const nsACString& aLangGroup) const {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
const nsString& FamilyName();
|
||||
|
||||
nsString mName;
|
||||
|
@ -215,6 +225,7 @@ public:
|
|||
PRPackedBool mIsBadUnderlineFont : 1;
|
||||
PRPackedBool mIsUserFont : 1;
|
||||
PRPackedBool mStandardFace : 1;
|
||||
PRPackedBool mSymbolFont : 1;
|
||||
|
||||
PRUint16 mWeight;
|
||||
PRInt16 mStretch;
|
||||
|
@ -235,6 +246,7 @@ protected:
|
|||
mIsBadUnderlineFont(PR_FALSE),
|
||||
mIsUserFont(PR_FALSE),
|
||||
mStandardFace(PR_FALSE),
|
||||
mSymbolFont(PR_FALSE),
|
||||
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
|
||||
mCmapInitialized(PR_FALSE),
|
||||
mUserFontData(nsnull),
|
||||
|
|
|
@ -57,246 +57,7 @@
|
|||
// exceptions. use gfxSparseBitSet instead?
|
||||
#include <bitset>
|
||||
|
||||
/**
|
||||
* List of different types of fonts we support on Windows.
|
||||
* These can generally be lumped in to 3 categories where we have to
|
||||
* do special things: Really old fonts bitmap and vector fonts (device
|
||||
* and raster), Type 1 fonts, and TrueType/OpenType fonts.
|
||||
*
|
||||
* This list is sorted in order from least prefered to most prefered.
|
||||
* We prefer Type1 fonts over OpenType fonts to avoid falling back to
|
||||
* things like Arial (opentype) when you ask for Helvetica (type1)
|
||||
**/
|
||||
enum gfxWindowsFontType {
|
||||
GFX_FONT_TYPE_UNKNOWN = 0,
|
||||
GFX_FONT_TYPE_DEVICE,
|
||||
GFX_FONT_TYPE_RASTER,
|
||||
GFX_FONT_TYPE_TRUETYPE,
|
||||
GFX_FONT_TYPE_PS_OPENTYPE,
|
||||
GFX_FONT_TYPE_TT_OPENTYPE,
|
||||
GFX_FONT_TYPE_TYPE1
|
||||
};
|
||||
|
||||
/**
|
||||
* FontFamily is a class that describes one of the fonts on the users system. It holds
|
||||
* each FontEntry (maps more directly to a font face) which holds font type, charset info
|
||||
* and character map info.
|
||||
*/
|
||||
class FontEntry;
|
||||
class FontFamily : public gfxFontFamily
|
||||
{
|
||||
public:
|
||||
FontFamily(const nsAString& aName) :
|
||||
gfxFontFamily(aName), mIsBadUnderlineFontFamily(PR_FALSE) { }
|
||||
|
||||
FontEntry *FindFontEntry(const gfxFontStyle& aFontStyle);
|
||||
|
||||
private:
|
||||
friend class gfxWindowsPlatform;
|
||||
|
||||
void FindStyleVariations();
|
||||
|
||||
static int CALLBACK FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
|
||||
const NEWTEXTMETRICEXW *nmetrics,
|
||||
DWORD fontType, LPARAM data);
|
||||
|
||||
protected:
|
||||
PRBool FindWeightsForStyle(gfxFontEntry* aFontsForWeights[],
|
||||
PRBool anItalic, PRInt16 aStretch);
|
||||
|
||||
public:
|
||||
PRPackedBool mIsBadUnderlineFontFamily;
|
||||
};
|
||||
|
||||
class FontEntry : public gfxFontEntry
|
||||
{
|
||||
public:
|
||||
FontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontType,
|
||||
PRBool aItalic, PRUint16 aWeight, gfxUserFontData *aUserFontData) :
|
||||
gfxFontEntry(aFaceName), mFontType(aFontType),
|
||||
mForceGDI(PR_FALSE), mUnknownCMAP(PR_FALSE),
|
||||
mUnicodeFont(PR_FALSE), mSymbolFont(PR_FALSE),
|
||||
mCharset(), mUnicodeRanges()
|
||||
{
|
||||
mUserFontData = aUserFontData;
|
||||
mItalic = aItalic;
|
||||
mWeight = aWeight;
|
||||
if (IsType1())
|
||||
mForceGDI = PR_TRUE;
|
||||
mIsUserFont = aUserFontData != nsnull;
|
||||
}
|
||||
|
||||
FontEntry(const FontEntry& aFontEntry) :
|
||||
gfxFontEntry(aFontEntry),
|
||||
mWindowsFamily(aFontEntry.mWindowsFamily),
|
||||
mWindowsPitch(aFontEntry.mWindowsPitch),
|
||||
mFontType(aFontEntry.mFontType),
|
||||
mForceGDI(aFontEntry.mForceGDI),
|
||||
mUnknownCMAP(aFontEntry.mUnknownCMAP),
|
||||
mUnicodeFont(aFontEntry.mUnicodeFont),
|
||||
mSymbolFont(aFontEntry.mSymbolFont),
|
||||
mCharset(aFontEntry.mCharset),
|
||||
mUnicodeRanges(aFontEntry.mUnicodeRanges)
|
||||
{
|
||||
|
||||
}
|
||||
static void InitializeFontEmbeddingProcs();
|
||||
|
||||
// create a font entry from downloaded font data
|
||||
static FontEntry* LoadFont(const gfxProxyFontEntry &aProxyEntry,
|
||||
const PRUint8 *aFontData,
|
||||
PRUint32 aLength);
|
||||
|
||||
// create a font entry for a font with a given name
|
||||
static FontEntry* CreateFontEntry(const nsAString& aName,
|
||||
gfxWindowsFontType aFontType,
|
||||
PRBool aItalic, PRUint16 aWeight,
|
||||
gfxUserFontData* aUserFontData,
|
||||
HDC hdc = 0, LOGFONTW *aLogFont = nsnull);
|
||||
|
||||
// create a font entry for a font referenced by its fullname
|
||||
static FontEntry* LoadLocalFont(const gfxProxyFontEntry &aProxyEntry,
|
||||
const nsAString& aFullname);
|
||||
|
||||
static void FillLogFont(LOGFONTW *aLogFont, const nsAString& aName,
|
||||
gfxWindowsFontType aFontType, PRBool aItalic,
|
||||
PRUint16 aWeight, gfxFloat aSize);
|
||||
|
||||
static gfxWindowsFontType DetermineFontType(const NEWTEXTMETRICW& metrics,
|
||||
DWORD fontType)
|
||||
{
|
||||
gfxWindowsFontType feType;
|
||||
if (metrics.ntmFlags & NTM_TYPE1)
|
||||
feType = GFX_FONT_TYPE_TYPE1;
|
||||
else if (metrics.ntmFlags & NTM_PS_OPENTYPE)
|
||||
feType = GFX_FONT_TYPE_PS_OPENTYPE;
|
||||
else if (metrics.ntmFlags & NTM_TT_OPENTYPE)
|
||||
feType = GFX_FONT_TYPE_TT_OPENTYPE;
|
||||
else if (fontType == TRUETYPE_FONTTYPE)
|
||||
feType = GFX_FONT_TYPE_TRUETYPE;
|
||||
else if (fontType == RASTER_FONTTYPE)
|
||||
feType = GFX_FONT_TYPE_RASTER;
|
||||
else if (fontType == DEVICE_FONTTYPE)
|
||||
feType = GFX_FONT_TYPE_DEVICE;
|
||||
else
|
||||
feType = GFX_FONT_TYPE_UNKNOWN;
|
||||
|
||||
return feType;
|
||||
}
|
||||
|
||||
PRBool IsType1() const {
|
||||
return (mFontType == GFX_FONT_TYPE_TYPE1);
|
||||
}
|
||||
|
||||
PRBool IsTrueType() const {
|
||||
return (mFontType == GFX_FONT_TYPE_TRUETYPE ||
|
||||
mFontType == GFX_FONT_TYPE_PS_OPENTYPE ||
|
||||
mFontType == GFX_FONT_TYPE_TT_OPENTYPE);
|
||||
}
|
||||
|
||||
PRBool IsCrappyFont() const {
|
||||
/* return if it is a bitmap not a unicode font */
|
||||
return (!mUnicodeFont || mSymbolFont || IsType1());
|
||||
}
|
||||
|
||||
PRBool MatchesGenericFamily(const nsACString& aGeneric) const {
|
||||
if (aGeneric.IsEmpty())
|
||||
return PR_TRUE;
|
||||
|
||||
// Japanese 'Mincho' fonts do not belong to FF_MODERN even if
|
||||
// they are fixed pitch because they have variable stroke width.
|
||||
if (mWindowsFamily == FF_ROMAN && mWindowsPitch & FIXED_PITCH) {
|
||||
return aGeneric.EqualsLiteral("monospace");
|
||||
}
|
||||
|
||||
// Japanese 'Gothic' fonts do not belong to FF_SWISS even if
|
||||
// they are variable pitch because they have constant stroke width.
|
||||
if (mWindowsFamily == FF_MODERN && mWindowsPitch & VARIABLE_PITCH) {
|
||||
return aGeneric.EqualsLiteral("sans-serif");
|
||||
}
|
||||
|
||||
// All other fonts will be grouped correctly using family...
|
||||
switch (mWindowsFamily) {
|
||||
case FF_DONTCARE:
|
||||
return PR_TRUE;
|
||||
case FF_ROMAN:
|
||||
return aGeneric.EqualsLiteral("serif");
|
||||
case FF_SWISS:
|
||||
return aGeneric.EqualsLiteral("sans-serif");
|
||||
case FF_MODERN:
|
||||
return aGeneric.EqualsLiteral("monospace");
|
||||
case FF_SCRIPT:
|
||||
return aGeneric.EqualsLiteral("cursive");
|
||||
case FF_DECORATIVE:
|
||||
return aGeneric.EqualsLiteral("fantasy");
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsLangGroup(const nsACString& aLangGroup) const {
|
||||
if (aLangGroup.IsEmpty())
|
||||
return PR_TRUE;
|
||||
|
||||
PRInt16 bit = -1;
|
||||
|
||||
/* map our langgroup names in to Windows charset bits */
|
||||
if (aLangGroup.EqualsLiteral("x-western")) {
|
||||
bit = ANSI_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("ja")) {
|
||||
bit = SHIFTJIS_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("ko")) {
|
||||
bit = HANGEUL_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("ko-XXX")) {
|
||||
bit = JOHAB_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("zh-CN")) {
|
||||
bit = GB2312_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("zh-TW")) {
|
||||
bit = CHINESEBIG5_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("el")) {
|
||||
bit = GREEK_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("tr")) {
|
||||
bit = TURKISH_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("he")) {
|
||||
bit = HEBREW_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("ar")) {
|
||||
bit = ARABIC_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("x-baltic")) {
|
||||
bit = BALTIC_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("x-cyrillic")) {
|
||||
bit = RUSSIAN_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("th")) {
|
||||
bit = THAI_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("x-central-euro")) {
|
||||
bit = EASTEUROPE_CHARSET;
|
||||
} else if (aLangGroup.EqualsLiteral("x-symbol")) {
|
||||
bit = SYMBOL_CHARSET;
|
||||
}
|
||||
|
||||
if (bit != -1)
|
||||
return mCharset[bit];
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool SupportsRange(PRUint8 range) {
|
||||
return mUnicodeRanges[range];
|
||||
}
|
||||
|
||||
PRBool TestCharacterMap(PRUint32 aCh);
|
||||
|
||||
PRUint8 mWindowsFamily;
|
||||
PRUint8 mWindowsPitch;
|
||||
|
||||
gfxWindowsFontType mFontType;
|
||||
PRPackedBool mForceGDI : 1;
|
||||
PRPackedBool mUnknownCMAP : 1;
|
||||
PRPackedBool mUnicodeFont : 1;
|
||||
PRPackedBool mSymbolFont : 1;
|
||||
|
||||
std::bitset<256> mCharset;
|
||||
std::bitset<128> mUnicodeRanges;
|
||||
};
|
||||
class GDIFontEntry;
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
|
@ -306,7 +67,7 @@ public:
|
|||
|
||||
class gfxWindowsFont : public gfxFont {
|
||||
public:
|
||||
gfxWindowsFont(FontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
|
||||
gfxWindowsFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
|
||||
cairo_antialias_t anAntialiasOption = CAIRO_ANTIALIAS_DEFAULT);
|
||||
virtual ~gfxWindowsFont();
|
||||
|
||||
|
@ -336,10 +97,10 @@ public:
|
|||
};
|
||||
|
||||
PRBool IsValid() { GetMetrics(); return mIsValid; }
|
||||
FontEntry *GetFontEntry();
|
||||
GDIFontEntry *GetFontEntry();
|
||||
|
||||
static already_AddRefed<gfxWindowsFont>
|
||||
GetOrMakeFont(FontEntry *aFontEntry, const gfxFontStyle *aStyle,
|
||||
GetOrMakeFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle,
|
||||
PRBool aNeedsBold = PR_FALSE);
|
||||
|
||||
protected:
|
||||
|
@ -390,28 +151,26 @@ public:
|
|||
return mGenericFamily;
|
||||
}
|
||||
|
||||
const nsTArray<nsRefPtr<FontEntry> >& GetFontList() const {
|
||||
return mFontEntries;
|
||||
}
|
||||
PRUint32 FontListLength() const {
|
||||
return mFontEntries.Length();
|
||||
}
|
||||
|
||||
FontEntry *GetFontEntryAt(PRInt32 i) {
|
||||
return mFontEntries[i];
|
||||
}
|
||||
|
||||
virtual gfxWindowsFont *GetFontAt(PRInt32 i);
|
||||
|
||||
void GroupFamilyListToArrayList(nsTArray<nsRefPtr<FontEntry> > *list,
|
||||
void GroupFamilyListToArrayList(nsTArray<nsRefPtr<gfxFontEntry> > *list,
|
||||
nsTArray<PRPackedBool> *aNeedsBold);
|
||||
void FamilyListToArrayList(const nsString& aFamilies,
|
||||
const nsCString& aLangGroup,
|
||||
nsTArray<nsRefPtr<FontEntry> > *list);
|
||||
nsTArray<nsRefPtr<gfxFontEntry> > *list);
|
||||
|
||||
void UpdateFontList();
|
||||
virtual void UpdateFontList();
|
||||
virtual gfxFloat GetUnderlineOffset();
|
||||
|
||||
gfxWindowsFont* GetFontAt(PRInt32 aFontIndex) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
return static_cast<gfxWindowsFont*>(static_cast<gfxFont*>(mFonts[aFontIndex]));
|
||||
}
|
||||
|
||||
protected:
|
||||
void InitFontList();
|
||||
|
@ -423,14 +182,19 @@ protected:
|
|||
already_AddRefed<gfxFont> WhichPrefFontSupportsChar(PRUint32 aCh);
|
||||
already_AddRefed<gfxFont> WhichSystemFontSupportsChar(PRUint32 aCh);
|
||||
|
||||
already_AddRefed<gfxWindowsFont> WhichFontSupportsChar(const nsTArray<nsRefPtr<FontEntry> >& fonts, PRUint32 ch);
|
||||
void GetPrefFonts(const char *aLangGroup, nsTArray<nsRefPtr<FontEntry> >& array);
|
||||
void GetCJKPrefFonts(nsTArray<nsRefPtr<FontEntry> >& array);
|
||||
already_AddRefed<gfxWindowsFont> WhichFontSupportsChar(const nsTArray<nsRefPtr<gfxFontEntry> >& fonts, PRUint32 ch);
|
||||
void GetPrefFonts(const char *aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& array);
|
||||
void GetCJKPrefFonts(nsTArray<nsRefPtr<gfxFontEntry> >& array);
|
||||
|
||||
static PRBool FindWindowsFont(const nsAString& aName,
|
||||
const nsACString& aGenericName,
|
||||
void *closure);
|
||||
|
||||
PRBool HasFont(gfxFontEntry *aFontEntry);
|
||||
|
||||
private:
|
||||
|
||||
nsCString mGenericFamily;
|
||||
nsTArray<nsRefPtr<FontEntry> > mFontEntries;
|
||||
nsTArray<PRPackedBool> mFontNeedsBold;
|
||||
|
||||
const char *mItemLangGroup; // used by pref-lang handling code
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef struct FT_LibraryRec_ *FT_Library;
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
class THEBES_API gfxWindowsPlatform : public gfxPlatform, private gfxFontInfoLoader {
|
||||
class THEBES_API gfxWindowsPlatform : public gfxPlatform {
|
||||
public:
|
||||
gfxWindowsPlatform();
|
||||
virtual ~gfxWindowsPlatform();
|
||||
|
@ -69,6 +69,8 @@ public:
|
|||
return (gfxWindowsPlatform*) gfxPlatform::GetPlatform();
|
||||
}
|
||||
|
||||
virtual gfxPlatformFontList* CreatePlatformFontList();
|
||||
|
||||
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
|
||||
gfxASurface::gfxImageFormat imageFormat);
|
||||
|
||||
|
@ -104,8 +106,6 @@ public:
|
|||
|
||||
nsresult UpdateFontList();
|
||||
|
||||
void GetFontFamilyList(nsTArray<nsRefPtr<FontFamily> >& aFamilyArray);
|
||||
|
||||
nsresult ResolveFontName(const nsAString& aFontName,
|
||||
FontResolverCallback aCallback,
|
||||
void *aClosure, PRBool& aAborted);
|
||||
|
@ -134,32 +134,17 @@ public:
|
|||
*/
|
||||
virtual PRBool IsFontFormatSupported(nsIURI *aFontURI, PRUint32 aFormatFlags);
|
||||
|
||||
/* Given a string and a font we already have find the font that
|
||||
* supports the most code points and most closely resembles aFont
|
||||
*
|
||||
* this involves looking at the fonts on your machine and seeing which
|
||||
* code points they support as well as looking at things like the font
|
||||
* family, style, weight, etc.
|
||||
*/
|
||||
already_AddRefed<gfxFont>
|
||||
FindFontForChar(PRUint32 aCh, gfxFont *aFont);
|
||||
|
||||
/* Find a FontFamily/FontEntry object that represents a font on your system given a name */
|
||||
FontFamily *FindFontFamily(const nsAString& aName);
|
||||
FontEntry *FindFontEntry(const nsAString& aName, const gfxFontStyle& aFontStyle);
|
||||
gfxFontFamily *FindFontFamily(const nsAString& aName);
|
||||
gfxFontEntry *FindFontEntry(const nsAString& aName, const gfxFontStyle& aFontStyle);
|
||||
|
||||
PRBool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<FontEntry> > *array);
|
||||
void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<FontEntry> >& array);
|
||||
PRBool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> > *array);
|
||||
void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& array);
|
||||
|
||||
void ClearPrefFonts() { mPrefFonts.Clear(); }
|
||||
|
||||
typedef nsDataHashtable<nsStringHashKey, nsRefPtr<FontFamily> > FontTable;
|
||||
|
||||
#ifdef MOZ_FT2_FONTS
|
||||
FT_Library GetFTLibrary();
|
||||
private:
|
||||
void AppendFacesFromFontFile(const PRUnichar *aFileName);
|
||||
void FindFonts();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -170,59 +155,10 @@ protected:
|
|||
private:
|
||||
void Init();
|
||||
|
||||
void InitBadUnderlineList();
|
||||
|
||||
static int CALLBACK FontEnumProc(const ENUMLOGFONTEXW *lpelfe,
|
||||
const NEWTEXTMETRICEXW *metrics,
|
||||
DWORD fontType, LPARAM data);
|
||||
static int CALLBACK FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
|
||||
const NEWTEXTMETRICEXW *nmetrics,
|
||||
DWORD fontType, LPARAM data);
|
||||
|
||||
static PLDHashOperator FontGetStylesProc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<FontFamily>& aFontFamily,
|
||||
void* userArg);
|
||||
|
||||
static PLDHashOperator FontGetCMapDataProc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<FontFamily>& aFontFamily,
|
||||
void* userArg);
|
||||
|
||||
static int CALLBACK FontResolveProc(const ENUMLOGFONTEXW *lpelfe,
|
||||
const NEWTEXTMETRICEXW *metrics,
|
||||
DWORD fontType, LPARAM data);
|
||||
|
||||
static PLDHashOperator HashEnumFunc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<FontFamily>& aData,
|
||||
void* userArg);
|
||||
|
||||
static PLDHashOperator FindFontForCharProc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<FontFamily>& aFontFamily,
|
||||
void* userArg);
|
||||
|
||||
virtual qcms_profile* GetPlatformCMSOutputProfile();
|
||||
|
||||
static int PrefChangedCallback(const char*, void*);
|
||||
|
||||
// gfxFontInfoLoader overrides, used to load in font cmaps
|
||||
virtual void InitLoader();
|
||||
virtual PRBool RunLoader();
|
||||
virtual void FinishLoader();
|
||||
|
||||
FontTable mFonts;
|
||||
FontTable mFontAliases;
|
||||
FontTable mFontSubstitutes;
|
||||
nsTArray<nsString> mNonExistingFonts;
|
||||
|
||||
// when system-wide font lookup fails for a character, cache it to skip future searches
|
||||
gfxSparseBitSet mCodepointsWithNoFonts;
|
||||
|
||||
nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<FontEntry> > > mPrefFonts;
|
||||
|
||||
// data used as part of the font cmap loading process
|
||||
nsTArray<nsRefPtr<FontFamily> > mFontFamilies;
|
||||
PRUint32 mStartIndex;
|
||||
PRUint32 mIncrement;
|
||||
PRUint32 mNumFamilies;
|
||||
// TODO: unify this with mPrefFonts (NB: holds families, not fonts) in gfxPlatformFontList
|
||||
nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > mPrefFonts;
|
||||
};
|
||||
|
||||
#endif /* GFX_WINDOWS_PLATFORM_H */
|
||||
|
|
|
@ -56,10 +56,13 @@ CPPSRCS += gfxFT2Fonts.cpp \
|
|||
gfxFT2FontBase.cpp \
|
||||
gfxFT2Utils.cpp \
|
||||
gfxDDrawSurface.cpp \
|
||||
gfxFT2FontList.cpp \
|
||||
$(NULL)
|
||||
EXTRA_DSO_LDOPTS += ddraw.lib
|
||||
else
|
||||
CPPSRCS += gfxWindowsFonts.cpp
|
||||
CPPSRCS += gfxWindowsFonts.cpp \
|
||||
gfxGDIFontList.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CPPSRCS += gfxPDFSurface.cpp
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <stuart@mozilla.com>
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
* Mats Palmgren <mats.palmgren@bredband.net>
|
||||
* John Daggett <jdaggett@mozilla.com>
|
||||
* Jonathan Kew <jfkthame@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "gfxFT2FontList.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxFontUtils.h"
|
||||
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
#include "gfxFT2Fonts.h"
|
||||
|
||||
#include "nsIPref.h" // for pref changes callback notification
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIWindowsRegKey.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define ROUND(x) floor((x) + 0.5)
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo *gFontInfoLog = PR_NewLogModule("fontInfoLog");
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
#define LOG(args) PR_LOG(gFontInfoLog, PR_LOG_DEBUG, args)
|
||||
#define LOG_ENABLED() PR_LOG_TEST(gFontInfoLog, PR_LOG_DEBUG)
|
||||
|
||||
static __inline void
|
||||
BuildKeyNameFromFontName(nsAString &aName)
|
||||
{
|
||||
if (aName.Length() >= LF_FACESIZE)
|
||||
aName.Truncate(LF_FACESIZE - 1);
|
||||
ToLowerCase(aName);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* gfxFT2FontList
|
||||
*
|
||||
*/
|
||||
|
||||
// For Mobile, we use gfxFT2Fonts, and we build the font list by directly scanning
|
||||
// the system's Fonts directory for OpenType and TrueType files.
|
||||
//
|
||||
// FontEntry is currently defined in gfxFT2Fonts.h, but will probably be moved here
|
||||
// as part of the Freetype/Linux font restructuring for Harfbuzz integration.
|
||||
//
|
||||
// TODO: investigate startup performance - we might be able to improve by avoiding
|
||||
// the creation of FT_Faces here, and just reading names directly from the file;
|
||||
// or even consider caching a mapping from font family name to (list of) filenames,
|
||||
// so that we don't have to scan all the files before we can do any font lookups.
|
||||
|
||||
gfxFT2FontList::gfxFT2FontList()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gfxFT2FontList::AppendFacesFromFontFile(const PRUnichar *aFileName)
|
||||
{
|
||||
char fileName[MAX_PATH];
|
||||
WideCharToMultiByte(CP_ACP, 0, aFileName, -1, fileName, MAX_PATH, NULL, NULL);
|
||||
FT_Library ftLibrary = gfxWindowsPlatform::GetPlatform()->GetFTLibrary();
|
||||
FT_Face dummy;
|
||||
if (FT_Err_Ok == FT_New_Face(ftLibrary, fileName, -1, &dummy)) {
|
||||
for (FT_Long i = 0; i < dummy->num_faces; i++) {
|
||||
FT_Face face;
|
||||
if (FT_Err_Ok != FT_New_Face(ftLibrary, fileName, i, &face))
|
||||
continue;
|
||||
|
||||
FontEntry* fe = FontEntry::CreateFontEntryFromFace(face);
|
||||
if (fe) {
|
||||
NS_ConvertUTF8toUTF16 name(face->family_name);
|
||||
BuildKeyNameFromFontName(name);
|
||||
gfxFontFamily *family = mFontFamilies.GetWeak(name);
|
||||
if (!family) {
|
||||
family = new gfxFontFamily(name);
|
||||
mFontFamilies.Put(name, family);
|
||||
}
|
||||
family->AddFontEntry(fe);
|
||||
family->SetHasStyles(PR_TRUE);
|
||||
#ifdef PR_LOGGING
|
||||
if (LOG_ENABLED()) {
|
||||
LOG(("(fontinit) added (%s) to family (%s)"
|
||||
" with style: %s weight: %d stretch: %d",
|
||||
NS_ConvertUTF16toUTF8(fe->Name()).get(),
|
||||
NS_ConvertUTF16toUTF8(family->Name()).get(),
|
||||
fe->IsItalic() ? "italic" : "normal",
|
||||
fe->Weight(), fe->Stretch()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
FT_Done_Face(dummy);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxFT2FontList::FindFonts()
|
||||
{
|
||||
nsTArray<nsString> searchPaths(3);
|
||||
nsTArray<nsString> fontPatterns(3);
|
||||
fontPatterns.AppendElement(NS_LITERAL_STRING("\\*.ttf"));
|
||||
fontPatterns.AppendElement(NS_LITERAL_STRING("\\*.ttc"));
|
||||
fontPatterns.AppendElement(NS_LITERAL_STRING("\\*.otf"));
|
||||
wchar_t pathBuf[256];
|
||||
SHGetSpecialFolderPathW(0, pathBuf, CSIDL_WINDOWS, 0);
|
||||
searchPaths.AppendElement(pathBuf);
|
||||
SHGetSpecialFolderPathW(0, pathBuf, CSIDL_FONTS, 0);
|
||||
searchPaths.AppendElement(pathBuf);
|
||||
nsCOMPtr<nsIFile> resDir;
|
||||
NS_GetSpecialDirectory(NS_APP_RES_DIR, getter_AddRefs(resDir));
|
||||
if (resDir) {
|
||||
resDir->Append(NS_LITERAL_STRING("fonts"));
|
||||
nsAutoString resPath;
|
||||
resDir->GetPath(resPath);
|
||||
searchPaths.AppendElement(resPath);
|
||||
}
|
||||
WIN32_FIND_DATAW results;
|
||||
for (PRUint32 i = 0; i < searchPaths.Length(); i++) {
|
||||
const nsString& path(searchPaths[i]);
|
||||
for (PRUint32 j = 0; j < fontPatterns.Length(); j++) {
|
||||
nsAutoString pattern(path);
|
||||
pattern.Append(fontPatterns[j]);
|
||||
HANDLE handle = FindFirstFileExW(pattern.get(),
|
||||
FindExInfoStandard,
|
||||
&results,
|
||||
FindExSearchNameMatch,
|
||||
NULL,
|
||||
0);
|
||||
PRBool moreFiles = handle != INVALID_HANDLE_VALUE;
|
||||
while (moreFiles) {
|
||||
nsAutoString filePath(path);
|
||||
filePath.AppendLiteral("\\");
|
||||
filePath.Append(results.cFileName);
|
||||
AppendFacesFromFontFile(static_cast<const PRUnichar*>(filePath.get()));
|
||||
moreFiles = FindNextFile(handle, &results);
|
||||
}
|
||||
if (handle != INVALID_HANDLE_VALUE)
|
||||
FindClose(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxFT2FontList::InitFontList()
|
||||
{
|
||||
mFontFamilies.Clear();
|
||||
mOtherFamilyNames.Clear();
|
||||
mOtherFamilyNamesInitialized = PR_FALSE;
|
||||
mPrefFonts.Clear();
|
||||
CancelLoader();
|
||||
|
||||
// initialize ranges of characters for which system-wide font search should be skipped
|
||||
mCodepointsWithNoFonts.reset();
|
||||
mCodepointsWithNoFonts.SetRange(0,0x1f); // C0 controls
|
||||
mCodepointsWithNoFonts.SetRange(0x7f,0x9f); // C1 controls
|
||||
|
||||
FindFonts();
|
||||
|
||||
InitBadUnderlineList();
|
||||
}
|
||||
|
||||
struct FullFontNameSearch {
|
||||
FullFontNameSearch(const nsAString& aFullName)
|
||||
: mFullName(aFullName), mFontEntry(nsnull)
|
||||
{ }
|
||||
|
||||
nsString mFullName;
|
||||
gfxFontEntry *mFontEntry;
|
||||
};
|
||||
|
||||
// callback called for each family name, based on the assumption that the
|
||||
// first part of the full name is the family name
|
||||
static PLDHashOperator
|
||||
FindFullName(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFontFamily,
|
||||
void* userArg)
|
||||
{
|
||||
FullFontNameSearch *data = reinterpret_cast<FullFontNameSearch*>(userArg);
|
||||
|
||||
// does the family name match up to the length of the family name?
|
||||
const nsString& family = aFontFamily->Name();
|
||||
|
||||
nsString fullNameFamily;
|
||||
data->mFullName.Left(fullNameFamily, family.Length());
|
||||
|
||||
// if so, iterate over faces in this family to see if there is a match
|
||||
if (family.Equals(fullNameFamily)) {
|
||||
nsTArray<nsRefPtr<gfxFontEntry> >& fontList = aFontFamily->GetFontList();
|
||||
int index, len = fontList.Length();
|
||||
for (index = 0; index < len; index++) {
|
||||
if (fontList[index]->Name().Equals(data->mFullName)) {
|
||||
data->mFontEntry = fontList[index];
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxFT2FontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
{
|
||||
// walk over list of names
|
||||
FullFontNameSearch data(aFontName);
|
||||
|
||||
mFontFamilies.Enumerate(FindFullName, &data);
|
||||
|
||||
return data.mFontEntry;
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxFT2FontList::GetDefaultFont(const gfxFontStyle* aStyle, PRBool& aNeedsBold)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
HGDIOBJ hGDI = ::GetStockObject(SYSTEM_FONT);
|
||||
LOGFONTW logFont;
|
||||
if (hGDI && ::GetObjectW(hGDI, sizeof(logFont), &logFont)) {
|
||||
nsAutoString resolvedName;
|
||||
if (ResolveFontName(nsDependentString(logFont.lfFaceName), resolvedName)) {
|
||||
return FindFontForFamily(resolvedName, aStyle, aNeedsBold);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* TODO: what about Qt or other platforms that may use this? */
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxFT2FontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const PRUint8 *aFontData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
// The FT2 font needs the font data to persist, so we do NOT free it here
|
||||
// but instead pass ownership to the font entry.
|
||||
// Deallocation will happen later, when the font face is destroyed.
|
||||
return FontEntry::CreateFontEntry(*aProxyEntry, aFontData, aLength);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <stuart@mozilla.com>
|
||||
* Masayuki Nakano <masayuki@d-toybox.com>
|
||||
* John Daggett <jdaggett@mozilla.com>
|
||||
* Jonathan Kew <jfkthame@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef GFX_FT2FONTLIST_H
|
||||
#define GFX_FT2FONTLIST_H
|
||||
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfxPlatformFontList.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <bitset>
|
||||
|
||||
class gfxFT2FontList : public gfxPlatformFontList
|
||||
{
|
||||
public:
|
||||
gfxFT2FontList();
|
||||
|
||||
virtual gfxFontEntry* GetDefaultFont(const gfxFontStyle* aStyle,
|
||||
PRBool& aNeedsBold);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const PRUint8 *aFontData,
|
||||
PRUint32 aLength);
|
||||
|
||||
protected:
|
||||
virtual void InitFontList();
|
||||
|
||||
void AppendFacesFromFontFile(const PRUnichar *aFileName);
|
||||
void FindFonts();
|
||||
};
|
||||
|
||||
#endif /* GFX_FT2FONTLIST_H */
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче