Merge MC -> JM

This commit is contained in:
Brian Hackett 2011-08-02 09:08:05 -07:00
commit 5c6df0c03d
635 changed files with 9015 additions and 11687 deletions

View File

@ -67,6 +67,8 @@
#include "nsMaiInterfaceDocument.h"
#include "nsMaiInterfaceImage.h"
using namespace mozilla::a11y;
nsAccessibleWrap::EAvailableAtkSignals nsAccessibleWrap::gAvailableAtkSignals =
eUnknown;
@ -826,21 +828,20 @@ getAttributesCB(AtkObject *aAtkObj)
AtkObject *
getParentCB(AtkObject *aAtkObj)
{
if (!aAtkObj->accessible_parent) {
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return nsnull;
}
if (!aAtkObj->accessible_parent) {
nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return nsnull;
nsAccessible* accParent = accWrap->GetParent();
if (!accParent)
return nsnull;
nsAccessible* accParent = accWrap->Parent();
if (!accParent)
return nsnull;
AtkObject *parent = nsAccessibleWrap::GetAtkObject(accParent);
if (parent)
atk_object_set_parent(aAtkObj, parent);
}
return aAtkObj->accessible_parent;
AtkObject* parent = nsAccessibleWrap::GetAtkObject(accParent);
if (parent)
atk_object_set_parent(aAtkObj, parent);
}
return aAtkObj->accessible_parent;
}
gint
@ -893,10 +894,9 @@ getIndexInParentCB(AtkObject *aAtkObj)
return -1;
}
nsAccessible *parent = accWrap->GetParent();
if (!parent) {
nsAccessible* parent = accWrap->Parent();
if (!parent)
return -1; // No parent
}
return parent->GetIndexOfEmbeddedChild(accWrap);
}

View File

@ -123,7 +123,7 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
if (!keyBinding.IsEmpty()) {
keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
nsAccessible* parent = acc->GetParent();
nsAccessible* parent = acc->Parent();
PRUint32 role = parent ? parent->Role() : 0;
if (role == nsIAccessibleRole::ROLE_PARENT_MENUITEM ||
role == nsIAccessibleRole::ROLE_MENUITEM ||
@ -141,7 +141,7 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
keysInHierarchyStr.Insert(str, 0);
}
} while ((parent = parent->GetParent()) &&
} while ((parent = parent->Parent()) &&
parent->Role() != nsIAccessibleRole::ROLE_MENUBAR);
keyBindingsStr.Append(';');

View File

@ -312,7 +312,7 @@ AccHideEvent::
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
{
mParent = mAccessible->GetParent();
mParent = mAccessible->Parent();
mNextSibling = mAccessible->NextSibling();
mPrevSibling = mAccessible->PrevSibling();
}

View File

@ -39,11 +39,13 @@
#include "States.h"
using namespace mozilla::a11y;
AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
mPosInSet(0), mSetSize(0), mParent(nsnull)
{
MOZ_COUNT_CTOR(AccGroupInfo);
nsAccessible* parent = aItem->GetParent();
nsAccessible* parent = aItem->Parent();
if (!parent)
return;

View File

@ -87,7 +87,12 @@ EXPORTS = \
nsAccessible.h \
nsAccessNode.h \
nsARIAMap.h \
States.h \
$(NULL)
EXPORTS_NAMESPACES = mozilla/a11y
EXPORTS_mozilla/a11y = \
States.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -374,8 +374,8 @@ NotificationController::CoalesceEvents()
return;
}
} else if (tailEvent->mEventType == nsIAccessibleEvent::EVENT_SHOW) {
if (thisEvent->mAccessible->GetParent() ==
tailEvent->mAccessible->GetParent()) {
if (thisEvent->mAccessible->Parent() ==
tailEvent->mAccessible->Parent()) {
tailEvent->mEventRule = thisEvent->mEventRule;
// Coalesce text change events for show events.

View File

@ -42,6 +42,8 @@
#include <prtypes.h>
namespace mozilla {
namespace a11y {
namespace states {
/**
@ -303,7 +305,9 @@ namespace states {
* @see EXPANDED and COLLAPSED states.
*/
const PRUint64 EXPANDABLE = ((PRUint64) 0x1) << 46;
}
} // namespace states
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -69,11 +69,9 @@ void
TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
PRUint32 aSkipStart)
{
nsAccessible* parent = mTextLeaf->GetParent();
if (!parent) {
NS_ERROR("No parent for text leaf!");
nsAccessible* parent = mTextLeaf->Parent();
if (!parent)
return;
}
mHyperText = parent->AsHyperText();
if (!mHyperText) {

View File

@ -41,6 +41,8 @@
#include "nsAccUtils.h"
#include "States.h"
using namespace mozilla::a11y;
bool
filters::GetSelected(nsAccessible* aAccessible)
{

View File

@ -45,6 +45,8 @@
#include "nsIMutableArray.h"
#include "nsComponentManagerUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsARIAGridAccessible
////////////////////////////////////////////////////////////////////////////////
@ -830,7 +832,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
nsAccessible *row = aAccessible->GetParent();
nsAccessible* row = aAccessible->Parent();
if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
nsAccUtils::IsARIASelected(row)) {
@ -949,11 +951,11 @@ nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table)
return NS_OK;
@ -975,7 +977,7 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
@ -1003,11 +1005,11 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
nsAccessible* table = row->GetParent();
nsAccessible* table = row->Parent();
if (!table)
return NS_OK;
@ -1096,7 +1098,7 @@ nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible *row = GetParent();
nsAccessible* row = Parent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
@ -1120,7 +1122,7 @@ nsARIAGridCellAccessible::ApplyARIAState(PRUint64* aState)
return;
// Check aria-selected="true" on the row.
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return;
@ -1144,7 +1146,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
// Expose "table-cell-index" attribute.
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
@ -1162,7 +1164,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
colCount++;
}
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table)
return NS_OK;

View File

@ -45,6 +45,8 @@
#include "nsAccessibilityAtoms.h"
#include "nsIContent.h"
using namespace mozilla::a11y;
/**
* This list of WAI-defined roles are currently hardcoded.
* Eventually we will most likely be loading an RDF resource that contains this information

View File

@ -57,6 +57,8 @@
#include "nsIWebNavigation.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsAccDocManager
////////////////////////////////////////////////////////////////////////////////

View File

@ -57,6 +57,8 @@
#include "nsWhitespaceTokenizer.h"
#include "nsComponentManagerUtils.h"
using namespace mozilla::a11y;
void
nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes,
nsIAtom *aAttrName, nsAString& aAttrValue)
@ -108,7 +110,7 @@ nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
return 1;
if (role == nsIAccessibleRole::ROLE_ROW) {
nsAccessible *parent = aAccessible->GetParent();
nsAccessible* parent = aAccessible->Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
// It is a row inside flatten treegrid. Group level is always 1 until it
// is overriden by aria-level attribute.
@ -338,7 +340,7 @@ nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
{
nsAccessible *document = aDescendant->GetDocAccessible();
nsAccessible *parent = aDescendant;
while ((parent = parent->GetParent())) {
while ((parent = parent->Parent())) {
PRUint32 testRole = parent->Role();
if (testRole == aRole)
return parent;
@ -359,7 +361,7 @@ nsAccUtils::GetSelectableContainer(nsAccessible* aAccessible, PRUint64 aState)
return nsnull;
nsAccessible* parent = aAccessible;
while ((parent = parent->GetParent()) && !parent->IsSelect()) {
while ((parent = parent->Parent()) && !parent->IsSelect()) {
if (Role(parent) == nsIAccessibleRole::ROLE_PANE)
return nsnull;
}
@ -420,7 +422,7 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
if (textAcc)
return textAcc;
} while (accessible = accessible->GetParent());
} while (accessible = accessible->Parent());
NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
return nsnull;

View File

@ -108,6 +108,8 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService
////////////////////////////////////////////////////////////////////////////////

View File

@ -108,6 +108,7 @@
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -421,8 +422,10 @@ NS_IMETHODIMP
nsAccessible::GetParent(nsIAccessible **aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aParent = GetParent());
NS_IF_ADDREF(*aParent = Parent());
return *aParent ? NS_OK : NS_ERROR_FAILURE;
}
@ -721,22 +724,33 @@ nsAccessible::NativeState()
/* readonly attribute boolean focusedChild; */
NS_IMETHODIMP
nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
{
nsAccessible *focusedChild = nsnull;
if (gLastFocusedNode == mContent) {
focusedChild = this;
}
else if (gLastFocusedNode) {
focusedChild = GetAccService()->GetAccessible(gLastFocusedNode);
if (focusedChild && focusedChild->GetParent() != this)
focusedChild = nsnull;
}
nsAccessible::GetFocusedChild(nsIAccessible** aChild)
{
NS_ENSURE_ARG_POINTER(aChild);
*aChild = nsnull;
NS_IF_ADDREF(*aFocusedChild = focusedChild);
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aChild = FocusedChild());
return NS_OK;
}
nsAccessible*
nsAccessible::FocusedChild()
{
if (!gLastFocusedNode)
return nsnull;
if (gLastFocusedNode == mContent)
return this;
nsAccessible* focusedChild = GetDocAccessible()->GetAccessible(gLastFocusedNode);
if (!focusedChild || focusedChild->Parent() != this)
return nsnull;
return focusedChild;
}
// nsAccessible::ChildAtPoint()
nsAccessible*
nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
@ -819,7 +833,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
// ensure obtained accessible is a child of this accessible.
nsAccessible* child = accessible;
while (true) {
nsAccessible* parent = child->GetParent();
nsAccessible* parent = child->Parent();
if (!parent) {
// Reached the top of the hierarchy. These bounds were inside an
// accessible that is not a descendant of this one.
@ -2140,9 +2154,8 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
nsIView *view = frame->GetViewExternal();
if (view) {
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget() || !frame->GetParent()) {
return nsRelUtils::AddTarget(aRelationType, aRelation, GetParent());
}
if (scrollFrame || view->GetWidget() || !frame->GetParent())
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
}
}
@ -2615,7 +2628,7 @@ nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
if (frame->GetType() == nsAccessibilityAtoms::brFrame) {
aText += kForcedNewLineChar;
} else if (nsAccUtils::MustPrune(GetParent())) {
} else if (nsAccUtils::MustPrune(Parent())) {
// Expose the embedded object accessible as imaginary embedded object
// character if its parent hypertext accessible doesn't expose children to
// AT.
@ -3257,16 +3270,18 @@ nsAccessible::GetLevelInternal()
{
PRInt32 level = nsAccUtils::GetDefaultLevel(this);
PRUint32 role = Role();
nsAccessible* parent = GetParent();
if (!IsBoundToParent())
return level;
PRUint32 role = Role();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
// Always expose 'level' attribute for 'outlineitem' accessible. The number
// of nested 'grouping' accessibles containing 'outlineitem' accessible is
// its level.
level = 1;
while (parent) {
nsAccessible* parent = this;
while ((parent = parent->Parent())) {
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
@ -3274,7 +3289,6 @@ nsAccessible::GetLevelInternal()
if (parentRole == nsIAccessibleRole::ROLE_GROUPING)
++ level;
parent = parent->GetParent();
}
} else if (role == nsIAccessibleRole::ROLE_LISTITEM) {
@ -3285,8 +3299,8 @@ nsAccessible::GetLevelInternal()
// Calculate 'level' attribute based on number of parent listitems.
level = 0;
while (parent) {
nsAccessible* parent = this;
while ((parent = parent->Parent())) {
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
@ -3294,23 +3308,20 @@ nsAccessible::GetLevelInternal()
else if (parentRole != nsIAccessibleRole::ROLE_LIST)
break;
parent = parent->GetParent();
}
if (level == 0) {
// If this listitem is on top of nested lists then expose 'level'
// attribute.
nsAccessible* parent(GetParent());
parent = Parent();
PRInt32 siblingCount = parent->GetChildCount();
for (PRInt32 siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
nsAccessible* sibling = parent->GetChildAt(siblingIdx);
nsCOMPtr<nsIAccessible> siblingChild;
sibling->GetLastChild(getter_AddRefs(siblingChild));
if (nsAccUtils::Role(siblingChild) == nsIAccessibleRole::ROLE_LIST) {
level = 1;
break;
}
nsAccessible* siblingChild = sibling->LastChild();
if (siblingChild &&
siblingChild->Role() == nsIAccessibleRole::ROLE_LIST)
return 1;
}
} else {
++ level; // level is 1-index based

View File

@ -40,7 +40,7 @@
#define _nsAccessible_H_
#include "nsAccessNodeWrap.h"
#include "States.h"
#include "mozilla/a11y/States.h"
#include "nsIAccessible.h"
#include "nsIAccessibleHyperLink.h"
@ -217,6 +217,11 @@ public:
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild);
/**
* Return the focused child if any.
*/
virtual nsAccessible* FocusedChild();
/**
* Return calculated group level based on accessible hierarchy.
*/
@ -279,7 +284,7 @@ public:
/**
* Return parent accessible.
*/
nsAccessible* GetParent() const { return mParent; }
nsAccessible* Parent() const { return mParent; }
/**
* Return child accessible at the given index.
@ -307,12 +312,20 @@ public:
PRBool HasChildren() { return !!GetChildAt(0); }
/**
* Return next/previous sibling of the accessible.
* Return first/last/next/previous sibling of the accessible.
*/
inline nsAccessible* NextSibling() const
{ return GetSiblingAtOffset(1); }
inline nsAccessible* PrevSibling() const
{ return GetSiblingAtOffset(-1); }
inline nsAccessible* FirstChild()
{ return GetChildCount() != 0 ? GetChildAt(0) : nsnull; }
inline nsAccessible* LastChild()
{
PRUint32 childCount = GetChildCount();
return childCount != 0 ? GetChildAt(childCount - 1) : nsnull;
}
/**
* Return embedded accessible children count.
@ -445,7 +458,7 @@ public:
// Perhaps we can get information about invalid links from the cache
// In the mean time authors can use role="link" aria-invalid="true"
// to force it for links they internally know to be invalid
return (0 == (State() & states::INVALID));
return (0 == (State() & mozilla::a11y::states::INVALID));
}
/**

View File

@ -53,6 +53,8 @@
#include "nsServiceManagerUtils.h"
#include "mozilla/Services.h"
using namespace mozilla::a11y;
nsApplicationAccessible::nsApplicationAccessible() :
nsAccessibleWrap(nsnull, nsnull)
{

View File

@ -53,6 +53,8 @@
#include "nsINameSpaceManager.h"
#include "nsIURI.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsLeafAccessible
////////////////////////////////////////////////////////////////////////////////
@ -234,8 +236,8 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
// on non accessible node in parent chain but this node is skipped when tree
// is traversed.
nsAccessible* walkUpAcc = this;
while ((walkUpAcc = walkUpAcc->GetParent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
walkUpAcc->State() & states::LINKED) {
mIsLink = PR_TRUE;
mActionAcc = walkUpAcc;

View File

@ -78,6 +78,7 @@
#endif
namespace dom = mozilla::dom;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// Static member initialization
@ -349,18 +350,15 @@ nsDocAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
nsAccessible*
nsDocAccessible::FocusedChild()
{
// XXXndeakin P3 accessibility shouldn't be caching the focus
if (!gLastFocusedNode) {
*aFocusedChild = nsnull;
return NS_OK;
}
// Return an accessible for the current global focus, which does not have to
// be contained within the current document.
NS_IF_ADDREF(*aFocusedChild = GetAccService()->GetAccessible(gLastFocusedNode));
return NS_OK;
return gLastFocusedNode ? GetAccService()->GetAccessible(gLastFocusedNode) :
nsnull;
}
NS_IMETHODIMP nsDocAccessible::TakeFocus()
@ -581,7 +579,7 @@ nsDocAccessible::GetAccessible(nsINode* aNode) const
// It will assert if not all the children were created
// when they were first cached, and no invalidation
// ever corrected parent accessible's child cache.
nsAccessible* parent(accessible->GetParent());
nsAccessible* parent = accessible->Parent();
if (parent)
parent->TestChildCache(accessible);
#endif
@ -1487,8 +1485,8 @@ nsDocAccessible::NotifyOfInitialUpdate()
// a problem then consider to keep event processing per tab document.
if (!IsRoot()) {
nsRefPtr<AccEvent> reorderEvent =
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, GetParent(),
eAutoDetect, AccEvent::eCoalesceFromSameSubtree);
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, Parent(), eAutoDetect,
AccEvent::eCoalesceFromSameSubtree);
ParentDocument()->FireDelayedAccessibleEvent(reorderEvent);
}
}
@ -1817,7 +1815,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode,
if (ancestor == this)
break;
ancestor = ancestor->GetParent();
ancestor = ancestor->Parent();
}
}
@ -1902,7 +1900,7 @@ nsDocAccessible::UpdateTreeInternal(nsAccessible* aChild, bool aIsInsert)
// The accessible parent may differ from container accessible if
// the parent doesn't have own DOM node like list accessible for HTML
// selects.
nsAccessible* parent = aChild->GetParent();
nsAccessible* parent = aChild->Parent();
NS_ASSERTION(parent, "No accessible parent?!");
if (parent)
parent->RemoveChild(aChild);

View File

@ -94,7 +94,6 @@ public:
// nsIAccessible
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD TakeFocus(void);
// nsIScrollPositionListener
@ -114,6 +113,7 @@ public:
// nsAccessible
virtual void Description(nsString& aDescription);
virtual nsAccessible* FocusedChild();
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();
virtual void ApplyARIAState(PRUint64* aState);

View File

@ -42,6 +42,8 @@
#include "nsAccUtils.h"
#include "nsDocAccessible.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsOuterDocAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -86,6 +86,7 @@
#endif
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsISupports
@ -699,14 +700,14 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
// is active.
return;
} else {
nsAccessible *containerAccessible = accessible->GetParent();
if (!containerAccessible)
nsAccessible* container = accessible->Parent();
if (!container)
return;
// It is not top level menuitem
// Only fire focus event if it is not inside collapsed popup
// and not a listitem of a combo box
if (containerAccessible->State() & states::COLLAPSED) {
nsAccessible *containerParent = containerAccessible->GetParent();
if (container->State() & states::COLLAPSED) {
nsAccessible* containerParent = container->Parent();
if (!containerParent)
return;
if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
@ -796,7 +797,7 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
// If ancestor chain of accessibles is not completely visible,
// don't use this one. This happens for example if it's inside
// a background tab (tabbed browsing)
nsAccessible *parent = accDoc->GetParent();
nsAccessible* parent = accDoc->Parent();
while (parent) {
if (parent->State() & states::INVISIBLE)
return nsnull;
@ -804,7 +805,7 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
if (parent == this)
break; // Don't check past original root accessible we started with
parent = parent->GetParent();
parent = parent->Parent();
}
NS_ADDREF(aStart);
@ -878,7 +879,7 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
// Fire expanded state change event for comboboxes and autocompeletes.
nsAccessible* combobox = aAccessible->GetParent();
nsAccessible* combobox = aAccessible->Parent();
if (!combobox)
return;
@ -914,7 +915,7 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode* aNode,
aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return;
nsAccessible* combobox = aAccessible->GetParent();
nsAccessible* combobox = aAccessible->Parent();
if (!combobox)
return;

View File

@ -60,6 +60,8 @@
#include "nsIServiceManager.h"
#include "nsITextControlFrame.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLCheckboxAccessible
////////////////////////////////////////////////////////////////////////////////
@ -407,8 +409,9 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
// This means we're part of another control, so use parent accessible for name.
// This ensures that a textbox inside of a XUL widget gets
// an accessible name.
nsAccessible* parent = GetParent();
parent->GetName(aName);
nsAccessible* parent = Parent();
if (parent)
parent->GetName(aName);
}
if (!aName.IsEmpty())
@ -452,7 +455,7 @@ nsHTMLTextFieldAccessible::NativeState()
state |= states::PROTECTED;
}
else {
nsAccessible* parent = GetParent();
nsAccessible* parent = Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
state |= states::HASPOPUP;
}
@ -650,7 +653,7 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
// Look for groupbox parent
nsAccessible* groupbox = GetParent();
nsAccessible* groupbox = Parent();
if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING) {
// XXX: if group box exposes more than one relation of the given type

View File

@ -53,6 +53,8 @@
#include "nsIDOMDocument.h"
#include "nsPIDOMWindow.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -45,6 +45,8 @@
#include "nsEventStates.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLinkAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -57,6 +57,8 @@
#include "nsIServiceManager.h"
#include "nsIMutableArray.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLSelectListAccessible
////////////////////////////////////////////////////////////////////////////////
@ -300,7 +302,7 @@ nsHTMLSelectOptionAccessible::NativeState()
// visibility implementation unless they get reimplemented in layout
state &= ~states::OFFSCREEN;
// <select> is not collapsed: compare bounds to calculate OFFSCREEN
nsAccessible* listAcc = GetParent();
nsAccessible* listAcc = Parent();
if (listAcc) {
PRInt32 optionX, optionY, optionWidth, optionHeight;
PRInt32 listX, listY, listWidth, listHeight;
@ -382,8 +384,9 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
if (!newHTMLOption)
return NS_ERROR_FAILURE;
// Clear old selection
nsAccessible* parent = GetParent();
NS_ASSERTION(parent, "No parent!");
nsAccessible* parent = Parent();
if (!parent)
return NS_OK;
nsCOMPtr<nsIContent> oldHTMLOptionContent =
GetFocusedOption(parent->GetContent());
@ -891,7 +894,7 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
{
*aBoundingFrame = nsnull;
nsAccessible* comboAcc = GetParent();
nsAccessible* comboAcc = Parent();
if (!comboAcc)
return;

View File

@ -66,6 +66,8 @@
#include "nsLayoutErrors.h"
#include "nsArrayUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableCellAccessible
////////////////////////////////////////////////////////////////////////////////
@ -266,7 +268,7 @@ already_AddRefed<nsIAccessibleTable>
nsHTMLTableCellAccessible::GetTableAccessible()
{
nsAccessible* parent = this;
while ((parent = parent->GetParent())) {
while ((parent = parent->Parent())) {
PRUint32 role = parent->Role();
if (role == nsIAccessibleRole::ROLE_TABLE ||
role == nsIAccessibleRole::ROLE_TREE_TABLE) {
@ -1528,8 +1530,9 @@ nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
aRelation);
NS_ENSURE_SUCCESS(rv, rv);
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR)
return nsRelUtils::AddTarget(aRelationType, aRelation, GetParent());
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
}
return NS_OK;
}

View File

@ -52,6 +52,8 @@
#include "nsISelectionController.h"
#include "nsComponentManagerUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTextAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -66,6 +66,8 @@
#include "nsTextFragment.h"
#include "gfxSkipChars.h"
using namespace mozilla::a11y;
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
////////////////////////////////////////////////////////////////////////////////
@ -621,9 +623,9 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
}
// From the descendant, go up and get the immediate child of this hypertext
nsAccessible *childAccAtOffset = nsnull;
nsAccessible* childAccAtOffset = nsnull;
while (descendantAcc) {
nsAccessible *parentAcc = descendantAcc->GetParent();
nsAccessible* parentAcc = descendantAcc->Parent();
if (parentAcc == this) {
childAccAtOffset = descendantAcc;
break;

View File

@ -52,6 +52,8 @@
#include "nsRootAccessible.h"
using namespace mozilla::a11y;
// These constants are only defined in OS X SDK 10.4, so we define them in order
// to be able to use for earlier OS versions.
const NSString *kInstanceDescriptionAttribute = @"AXDescription"; // NSAccessibilityDescriptionAttribute
@ -334,9 +336,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
if (mIsExpired)
return nil;
nsCOMPtr<nsIAccessible> focusedGeckoChild;
mGeckoAccessible->GetFocusedChild (getter_AddRefs (focusedGeckoChild));
nsAccessible* focusedGeckoChild = mGeckoAccessible->FocusedChild();
if (focusedGeckoChild) {
mozAccessible *focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
if (focusedChild)

View File

@ -41,6 +41,8 @@
#include "nsObjCExceptions.h"
using namespace mozilla::a11y;
extern const NSString *kInstanceDescriptionAttribute; // NSAccessibilityDescriptionAttribute
extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevelUIElementAttribute

View File

@ -3,6 +3,8 @@
#import "mozTextAccessible.h"
using namespace mozilla::a11y;
extern const NSString *kInstanceDescriptionAttribute; // NSAccessibilityDescriptionAttribute
extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevelUIElementAttribute

View File

@ -86,7 +86,7 @@ class nsAccessibleWrap : public nsAccessible
PRInt32 GetUnignoredChildCount(PRBool aDeepCount);
PRBool HasPopup () {
return (NativeState() & states::HASPOPUP);
return (NativeState() & mozilla::a11y::states::HASPOPUP);
}
// return this accessible's all children, adhering to "flat" accessibles by not returning their children.

View File

@ -285,7 +285,7 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
already_AddRefed<nsIAccessible>
nsAccessibleWrap::GetUnignoredParent()
{
nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>(GetParent());
nsAccessibleWrap* parentWrap = static_cast<nsAccessibleWrap*>(Parent());
if (!parentWrap)
return nsnull;
@ -313,12 +313,12 @@ nsAccessibleWrap::AncestorIsFlat()
// look the same on all platforms, we still let the C++ objects be created
// though.
nsAccessible* parent(GetParent());
nsAccessible* parent = Parent();
while (parent) {
if (nsAccUtils::MustPrune(parent))
return PR_TRUE;
parent = parent->GetParent();
parent = parent->Parent();
}
// no parent was flat
return PR_FALSE;

View File

@ -50,6 +50,8 @@
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMNSRGBAColor.h"
using namespace mozilla::a11y;
enum {
IA2AlphaShift = 24,
IA2RedShift = 16,

View File

@ -61,9 +61,6 @@
#include "OLEIDL.H"
#include "OLEACC.H"
#include <winuser.h>
#ifndef WINABLEAPI
#include <winable.h>
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif

View File

@ -67,6 +67,8 @@
#include "nsEventMap.h"
#include "nsArrayUtils.h"
using namespace mozilla::a11y;
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
@ -214,7 +216,7 @@ __try {
}
}
nsAccessible* xpParentAcc = GetParent();
nsAccessible* xpParentAcc = Parent();
if (!xpParentAcc) {
if (IsApplication())
return S_OK;
@ -374,7 +376,7 @@ __try {
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
nsAccessible* xpParent = GetParent();
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -522,8 +524,7 @@ __try {
VariantInit(pvarChild);
// Return the current IAccessible child that has focus
nsCOMPtr<nsIAccessible> focusedAccessible;
GetFocusedChild(getter_AddRefs(focusedAccessible));
nsAccessible* focusedAccessible = FocusedChild();
if (focusedAccessible == this) {
pvarChild->vt = VT_I4;
pvarChild->lVal = CHILDID_SELF;
@ -1160,7 +1161,7 @@ __try {
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
nsAccessible* xpParent = GetParent();
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -1768,12 +1769,12 @@ nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
// Check whether the accessible for the given ID is a child of ARIA
// document.
nsAccessible* parent = child ? child->GetParent() : nsnull;
nsAccessible* parent = child ? child->Parent() : nsnull;
while (parent && parent != document) {
if (parent == this)
return child;
parent = parent->GetParent();
parent = parent->Parent();
}
}

View File

@ -39,9 +39,6 @@
* ***** END LICENSE BLOCK ***** */
#include <winuser.h>
#ifndef WINABLEAPI
#include <winable.h>
#endif
#include "AccessibleEventId.h"
const PRUint32 kEVENT_WIN_UNKNOWN = 0x00000000;

View File

@ -40,6 +40,8 @@
#include "States.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLWin32ObjectOwnerAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -52,6 +52,8 @@
#include "nsIXFormsUtilityService.h"
#include "nsIPlaintextEditor.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXFormsAccessibleBase
////////////////////////////////////////////////////////////////////////////////

View File

@ -41,6 +41,8 @@
#include "States.h"
#include "nsTextEquivUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXFormsLabelAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -40,6 +40,8 @@
#include "States.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXFormsDropmarkerWidgetAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -39,6 +39,8 @@
#include "States.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULAlertAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -46,6 +46,7 @@
#include "nsIDOMElement.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULColorPickerTileAccessible

View File

@ -47,6 +47,8 @@
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULComboboxAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -62,6 +62,8 @@
#include "nsINameSpaceManager.h"
#include "nsITextControlFrame.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULButtonAccessible
////////////////////////////////////////////////////////////////////////////////
@ -573,8 +575,9 @@ nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 setSize = 0;
PRInt32 posInSet = 0;
nsAccessible* parent(GetParent());
NS_ENSURE_TRUE(parent,);
nsAccessible* parent = Parent();
if (!parent)
return;
PRInt32 childCount = parent->GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {

View File

@ -48,6 +48,8 @@
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnsAccessible
////////////////////////////////////////////////////////////////////////////////
@ -998,11 +1000,11 @@ nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
return NS_OK;
@ -1019,7 +1021,7 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
@ -1048,11 +1050,11 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
nsAccessible* table = row->GetParent();
nsAccessible* table = row->Parent();
if (!table)
return NS_OK;

View File

@ -61,7 +61,7 @@
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
@ -332,8 +332,8 @@ nsXULMenuitemAccessible::NativeState()
// Is collapsed?
PRBool isCollapsed = PR_FALSE;
nsAccessible* parentAcc = GetParent();
if (parentAcc->State() & states::INVISIBLE)
nsAccessible* parent = Parent();
if (parent && parent->State() & states::INVISIBLE)
isCollapsed = PR_TRUE;
if (isSelected) {
@ -342,11 +342,12 @@ nsXULMenuitemAccessible::NativeState()
// Selected and collapsed?
if (isCollapsed) {
// Set selected option offscreen/invisible according to combobox state
nsAccessible* grandParentAcc = parentAcc->GetParent();
NS_ENSURE_TRUE(grandParentAcc, state);
NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
nsAccessible* grandParent = parent->Parent();
if (!grandParent)
return state;
NS_ASSERTION(grandParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
"grandparent of combobox listitem is not combobox");
PRUint64 grandParentState = grandParentAcc->State();
PRUint64 grandParentState = grandParent->State();
state &= ~(states::OFFSCREEN | states::INVISIBLE);
state |= (grandParentState & states::OFFSCREEN) |
(grandParentState & states::INVISIBLE) |
@ -404,7 +405,7 @@ nsXULMenuitemAccessible::AccessKey() const
PRUint32 modifierKey = 0;
nsAccessible* parentAcc = GetParent();
nsAccessible* parentAcc = Parent();
if (parentAcc) {
if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
@ -639,8 +640,9 @@ nsXULMenupopupAccessible::NativeState()
PRBool isActive = mContent->HasAttr(kNameSpaceID_None,
nsAccessibilityAtoms::menuactive);
if (!isActive) {
nsAccessible* parent(GetParent());
NS_ENSURE_TRUE(parent, state);
nsAccessible* parent = Parent();
if (!parent)
return state;
nsIContent *parentContent = parnet->GetContent();
NS_ENSURE_TRUE(parentContent, state);
@ -685,7 +687,7 @@ nsXULMenupopupAccessible::NativeRole()
if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
// Some widgets like the search bar have several popups, owned by buttons.
nsAccessible* grandParent = mParent->GetParent();
nsAccessible* grandParent = mParent->Parent();
if (grandParent &&
grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;

View File

@ -45,6 +45,8 @@
#include "nsIDOMDocumentXBL.h"
#include "nsIFrame.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULSliderAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -50,6 +50,8 @@
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULRelatedElement.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULTabAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -53,6 +53,8 @@
#include "nsString.h"
#include "nsNetUtil.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULTextAccessible
////////////////////////////////////////////////////////////////////////////////
@ -98,7 +100,7 @@ nsXULTextAccessible::GetRelationByType(PRUint32 aRelationType,
// Caption is the label for groupbox
nsIContent *parent = mContent->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
nsAccessible* parent = GetParent();
nsAccessible* parent = Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
}

View File

@ -52,6 +52,8 @@
#include "nsIMutableArray.h"
#include "nsComponentManagerUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible
////////////////////////////////////////////////////////////////////////////////
@ -200,17 +202,11 @@ nsXULTreeAccessible::NativeRole()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
nsAccessible*
nsXULTreeAccessible::FocusedChild()
{
NS_ENSURE_ARG_POINTER(aFocusedChild);
*aFocusedChild = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
if (gLastFocusedNode != mContent)
return NS_OK;
return nsnull;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
do_QueryInterface(mContent);
@ -218,10 +214,10 @@ nsXULTreeAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
PRInt32 row = -1;
multiSelect->GetCurrentIndex(&row);
if (row >= 0)
NS_IF_ADDREF(*aFocusedChild = GetTreeItemAccessible(row));
return GetTreeItemAccessible(row);
}
return NS_OK;
return nsnull;
}
////////////////////////////////////////////////////////////////////////////////
@ -661,17 +657,11 @@ NS_IMPL_RELEASE_INHERITED(nsXULTreeItemAccessibleBase, nsAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::GetFocusedChild(nsIAccessible **aFocusedChild)
nsAccessible*
nsXULTreeItemAccessibleBase::FocusedChild()
{
NS_ENSURE_ARG_POINTER(aFocusedChild);
*aFocusedChild = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
if (gLastFocusedNode != mContent)
return NS_OK;
return nsnull;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
do_QueryInterface(mContent);
@ -680,10 +670,10 @@ nsXULTreeItemAccessibleBase::GetFocusedChild(nsIAccessible **aFocusedChild)
PRInt32 row = -1;
multiSelect->GetCurrentIndex(&row);
if (row == mRow)
NS_ADDREF(*aFocusedChild = this);
return this;
}
return NS_OK;
return nsnull;
}
NS_IMETHODIMP
@ -1225,7 +1215,7 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
PRInt32 rowCount = 0;
treeView->GetRowCount(&rowCount);
if (rowCount > 0 && aOffset <= rowCount) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(GetParent());
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(Parent());
if (treeAcc)
return treeAcc->GetTreeItemAccessible(aOffset - 1);

View File

@ -76,7 +76,6 @@ public:
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
// nsAccessNode
virtual bool IsDefunct() const;
@ -87,6 +86,7 @@ public:
virtual PRUint64 NativeState();
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild);
virtual nsAccessible* FocusedChild();
virtual nsAccessible* GetChildAt(PRUint32 aIndex);
virtual PRInt32 GetChildCount();
@ -182,8 +182,6 @@ public:
nsAccessibleWrap)
// nsIAccessible
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
@ -209,6 +207,7 @@ public:
// nsAccessible
virtual PRUint64 NativeState();
virtual PRInt32 IndexInParent() const;
virtual nsAccessible* FocusedChild();
// nsXULTreeItemAccessibleBase
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)

View File

@ -47,6 +47,8 @@
#include "nsITreeSelection.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible
////////////////////////////////////////////////////////////////////////////////
@ -848,13 +850,10 @@ NS_IMPL_RELEASE_INHERITED(nsXULTreeGridCellAccessible, nsLeafAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
nsAccessible*
nsXULTreeGridCellAccessible::FocusedChild()
{
NS_ENSURE_ARG_POINTER(aFocusedChild);
*aFocusedChild = nsnull;
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
return nsnull;
}
NS_IMETHODIMP
@ -1016,7 +1015,10 @@ nsXULTreeGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_OK;
CallQueryInterface(mParent->GetParent(), aTable);
nsAccessible* grandParent = mParent->Parent();
if (grandParent)
CallQueryInterface(grandParent, aTable);
return NS_OK;
}
@ -1171,9 +1173,12 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
return NS_ERROR_FAILURE;
// "table-cell-index" attribute
nsCOMPtr<nsIAccessible> accessible;
mParent->GetParent(getter_AddRefs(accessible));
nsCOMPtr<nsIAccessibleTable> tableAccessible = do_QueryInterface(accessible);
nsAccessible* grandParent = mParent->Parent();
if (!grandParent)
return NS_OK;
nsCOMPtr<nsIAccessibleTable> tableAccessible =
do_QueryInterface(static_cast<nsIAccessible*>(grandParent));
// XXX - temp fix for crash bug 516047
if (!tableAccessible)
@ -1308,7 +1313,7 @@ nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
if (!columnAtOffset)
return nsnull;
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(GetParent());
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
return rowAcc->GetCellAccessible(columnAtOffset);
}

View File

@ -143,7 +143,6 @@ public:
nsLeafAccessible)
// nsIAccessible
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
@ -162,6 +161,7 @@ public:
virtual bool IsPrimaryForNode() const;
// nsAccessible
virtual nsAccessible* FocusedChild();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual PRUint32 NativeRole();
virtual PRUint64 NativeState();

View File

@ -762,6 +762,12 @@ function synthClick(aNodeOrID, aCheckerOrEventSeq, aEventType)
synthesizeMouse(this.DOMNode, 1, 1, {});
}
this.finalCheck = function synthClick_finalCheck()
{
// Scroll top window back.
window.top.scrollTo(0, 0);
}
this.getID = function synthClick_getID()
{
return prettyName(aNodeOrID) + " click";

View File

@ -103,13 +103,15 @@
{
this.type = EVENT_NAME_CHANGE;
this.target getter = function()
function targetGetter()
{
var acc = getAccessible(gTree);
var tableAcc = getAccessible(acc, [nsIAccessibleTable]);
return tableAcc.getCellAt(aRow, aCol);
}
Object.defineProperty(this, "target", { get: targetGetter });
this.getID = function getID()
{
return aMsg + "name changed";

View File

@ -235,7 +235,7 @@
};
if (LINUX || SOLARIS)
tree.children[2].children[0].\(subsubmenuTree);
tree.children[2].children[0].children.push(subsubmenuTree);
else
tree.children[2].children[0].children[0].children[0].children.push(subsubmenuTree);

View File

@ -376,12 +376,12 @@
{ INTERNAL_FRAME: [
{ DOCUMENT: [
{ ENTRY: [ ] }
] };
] }
] };
testAccessibleTree(this.containerNode, tree);
}
this.getID() = function changeSrc_getID()
this.getID = function changeSrc_getID()
{
return "change src on iframe";
}

View File

@ -1,213 +0,0 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1311096050000">
<emItems>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.0.00" severity="1">
</versionRange>
</emItem>
<emItem blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
<versionRange minVersion=" " severity="1">
</versionRange>
</emItem>
<emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion="3.3.1" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="5.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i19" id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
<versionRange minVersion="1.1b1" maxVersion="1.1b1">
</versionRange>
</emItem>
<emItem blockID="i16" id="{27182e60-b5f3-411c-b545-b44205977502}">
<versionRange minVersion="1.0" maxVersion="1.0">
</versionRange>
</emItem>
<emItem blockID="i39" id="{c2d64ff7-0ab8-4263-89c9-ea3b0f8f050c}">
<versionRange minVersion="0.1" maxVersion="4.3.0.00" severity="1">
</versionRange>
</emItem>
<emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}">
</emItem>
<emItem blockID="i1" id="mozilla_cc@internetdownloadmanager.com">
<versionRange minVersion="2.1" maxVersion="3.3">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion=" " maxVersion="6.9.8">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i18" id="msntoolbar@msn.com">
<versionRange minVersion=" " maxVersion="6.*">
</versionRange>
</emItem>
<emItem blockID="i13" id="{E8E88AB0-7182-11DF-904E-6045E0D72085}">
</emItem>
<emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i40" id="{28387537-e3f9-4ed7-860c-11e69af4a8a0}">
<versionRange minVersion="0.1" maxVersion="4.3.0.00" severity="1">
</versionRange>
</emItem>
<emItem blockID="i23" id="firefox@bandoo.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i22" id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0">
</versionRange>
</emItem>
<emItem blockID="i2" id="fdm_ffext@freedownloadmanager.org">
<versionRange minVersion="1.0" maxVersion="1.3.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i5" id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5">
</versionRange>
</emItem>
<emItem blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
<versionRange minVersion=" " maxVersion="8.5">
</versionRange>
</emItem>
<emItem blockID="i12" id="masterfiler@gmail.com">
<versionRange severity="3">
</versionRange>
</emItem>
<emItem blockID="i20" id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
</versionRange>
</emItem>
<emItem blockID="i11" id="yslow@yahoo-inc.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2">
</versionRange>
</emItem>
<emItem blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
<versionRange minVersion="2.0" maxVersion="2.0">
</versionRange>
</emItem>
<emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
</emItem>
<emItem blockID="i24" id="{6E19037A-12E3-4295-8915-ED48BC341614}">
<versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i15" id="personas@christopher.beard">
<versionRange minVersion="1.6" maxVersion="1.6">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6" maxVersion="3.6.*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i21" id="support@update-firefox.com">
</emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p26">
<match name="name" exp="^Yahoo Application State Plugin$" /> <match name="description" exp="^Yahoo Application State Plugin$" /> <match name="filename" exp="npYState.dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p27">
<match name="name" exp="QuickTime Plug-in 7[.]1[.]" /> <match name="filename" exp="npqtplugin.?[.]dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p28">
<match name="filename" exp="NPFFAddOn.dll" /> <versionRange >
</versionRange>
</pluginItem>
<pluginItem blockID="p31">
<match name="filename" exp="NPMySrch.dll" /> <versionRange >
</versionRange>
</pluginItem>
<pluginItem blockID="p32">
<match name="filename" exp="npViewpoint.dll" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p33">
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1">
</versionRange>
</pluginItem>
<pluginItem blockID="p34">
<match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]" /> <versionRange >
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
</pluginItems>
<gfxItems>
<gfxBlacklistEntry blockID="g35">
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT2D</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g36">
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g37">
<os>WINNT 5.1</os>
<vendor>0x10de</vendor>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>7.0.0.0</driverVersion>
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>

View File

@ -97,13 +97,13 @@ function _handleEvent(aEvent) {
// Methods that impact a browser. Put into single object for organization.
let BrowserHelper = {
onOpen: function(aBrowser) {
onOpen: function NP_BH_onOpen(aBrowser) {
// If the tab is in the focused window, leave priority as it is
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
this.decreasePriority(aBrowser);
},
onSelect: function(aBrowser) {
onSelect: function NP_BH_onSelect(aBrowser) {
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
if (windowEntry.lastSelectedBrowser)
this.decreasePriority(windowEntry.lastSelectedBrowser);
@ -113,16 +113,16 @@ let BrowserHelper = {
},
// Auxiliary methods
getLoadgroup: function(aBrowser) {
getLoadgroup: function NP_BH_getLoadgroup(aBrowser) {
return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
},
increasePriority: function(aBrowser) {
increasePriority: function NP_BH_increasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA);
},
decreasePriority: function(aBrowser) {
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1);
}
};
@ -130,7 +130,7 @@ let BrowserHelper = {
// Methods that impact a window. Put into single object for organization.
let WindowHelper = {
addWindow: function(aWindow) {
addWindow: function NP_WH_addWindow(aWindow) {
// Build internal data object
_windows.push({ window: aWindow, lastSelectedBrowser: null });
@ -153,7 +153,7 @@ let WindowHelper = {
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
},
removeWindow: function(aWindow) {
removeWindow: function NP_WH_removeWindow(aWindow) {
if (aWindow == _lastFocusedWindow)
_lastFocusedWindow = null;
@ -169,7 +169,7 @@ let WindowHelper = {
});
},
onActivate: function(aWindow, aHasFocus) {
onActivate: function NP_WH_onActivate(aWindow, aHasFocus) {
// If this window was the last focused window, we don't need to do anything
if (aWindow == _lastFocusedWindow)
return;
@ -181,7 +181,7 @@ let WindowHelper = {
this.increasePriority(aWindow);
},
handleFocusedWindow: function(aWindow) {
handleFocusedWindow: function NP_WH_handleFocusedWindow(aWindow) {
// If we have a last focused window, we need to deprioritize it first
if (_lastFocusedWindow)
this.decreasePriority(_lastFocusedWindow);
@ -191,23 +191,23 @@ let WindowHelper = {
},
// Auxiliary methods
increasePriority: function(aWindow) {
increasePriority: function NP_WH_increasePriority(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.increasePriority(aBrowser);
});
},
decreasePriority: function(aWindow) {
decreasePriority: function NP_WH_decreasePriority(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.decreasePriority(aBrowser);
});
},
getEntry: function(aWindow) {
getEntry: function NP_WH_getEntry(aWindow) {
return _windows[this.getEntryIndex(aWindow)];
},
getEntryIndex: function(aWindow) {
getEntryIndex: function NP_WH_getEntryAtIndex(aWindow) {
// Assumes that every object has a unique window & it's in the array
for (let i = 0; i < _windows.length; i++)
if (_windows[i].window == aWindow)

View File

@ -262,7 +262,9 @@ var FullZoom = {
var self = this;
Services.contentPrefs.getPref(aURI, this.name, function (aResult) {
// Check that we're still where we expect to be in case this took a while.
if (aURI.equals(browser.currentURI)) {
// Null check currentURI, since the window may have been destroyed before
// we were called.
if (browser.currentURI && aURI.equals(browser.currentURI)) {
self._applyPrefToSetting(aResult, browser);
}
});

View File

@ -63,10 +63,6 @@ tabbrowser {
display: block; /* position:fixed already does this (bug 579776), but let's be explicit */
}
.tabbrowser-tabs[drag] > .tabbrowser-tab {
pointer-events: none; /* suppress tooltips */
}
.tabbrowser-tabs[drag] > .tabbrowser-tab[selected] {
z-index: 2; /* ensure selected tab stays on top despite -moz-transform */
}

View File

@ -355,6 +355,9 @@ const gSessionHistoryObserver = {
var fwdCommand = document.getElementById("Browser:Forward");
fwdCommand.setAttribute("disabled", "true");
// Hide session restore button on about:home
window.messageManager.sendAsyncMessage("Browser:HideSessionRestoreButton");
if (gURLBar) {
// Clear undo history of the URL bar
gURLBar.editor.transactionManager.clear()

View File

@ -51,3 +51,13 @@ addMessageListener("WebNavigation:LoadURI", function (message) {
webNavigation.loadURI(message.json.uri, flags, null, null, null);
});
addMessageListener("Browser:HideSessionRestoreButton", function (message) {
// Hide session restore button on about:home
let doc = content.document;
let container;
if (doc.documentURI.toLowerCase() == "about:home" &&
(container = doc.getElementById("sessionRestoreContainer"))){
container.hidden = true;
}
});

View File

@ -2456,7 +2456,7 @@
<body><![CDATA[
event.stopPropagation();
var tab = document.tooltipNode;
if (tab.localName != "tab") {
if (tab.localName != "tab" || this.tabContainer.draggedTab) {
event.preventDefault();
return;
}
@ -3813,6 +3813,19 @@
if (!tab || !tab._fullyOpen || tab.closing)
return;
#ifdef XP_MACOSX
if (event.altKey) {
#else
if (event.ctrlKey) {
#endif
let dt = event.dataTransfer;
let browser = tab.linkedBrowser;
dt.setData("text/x-moz-url", browser.currentURI.spec + "\n" + browser.contentTitle);
let favicon = document.getAnonymousElementByAttribute(tab, "class", "tab-icon-image");
dt.setDragImage(favicon, 16, 16);
return;
}
this.setAttribute("drag", "move");
this.draggedTab = tab;
tab.setAttribute("dragged", "true");

View File

@ -138,8 +138,7 @@ PlacesController.prototype = {
},
terminate: function PC_terminate() {
if (this._cutNodes.length > 0)
this._clearClipboard();
this._releaseClipboardOwnership();
},
supportsCommand: function PC_supportsCommand(aCommand) {
@ -1128,14 +1127,20 @@ PlacesController.prototype = {
return action;
},
_releaseClipboardOwnership: function PC__releaseClipboardOwnership() {
if (this.cutNodes.length > 0) {
// This clears the logical clipboard, doesn't remove data.
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
}
},
_clearClipboard: function PC__clearClipboard() {
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
// Unfortunately just invoking emptyClipboard is not enough, since it
// does not act on the native clipboard.
let xferable = Cc["@mozilla.org/widget/transferable;1"].
createInstance(Ci.nsITransferable);
// GTK doesn't like empty transferables, so just add an unknown type.
xferable.addDataFlavor("text/x-moz-place-empty");
// Empty transferables may cause crashes, so just add an unknown type.
const TYPE = "text/x-moz-place-empty";
xferable.addDataFlavor(TYPE);
xferable.setTransferData(TYPE, PlacesUtils.toISupportsString(""), 0);
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
},
@ -1195,11 +1200,15 @@ PlacesController.prototype = {
// concurrent instances of the application.
addData(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION, aAction + "," + this.profileName);
if (hasData)
this.clipboard.setData(xferable, this, Ci.nsIClipboard.kGlobalClipboard);
if (hasData) {
this.clipboard.setData(xferable,
this.cutNodes.length > 0 ? this : null,
Ci.nsIClipboard.kGlobalClipboard);
}
},
_cutNodes: [],
get cutNodes() this._cutNodes,
set cutNodes(aNodes) {
let self = this;
function updateCutNodes(aValue) {

View File

@ -44,7 +44,8 @@ function onLibraryReady() {
}
function onClipboardReady() {
tests.pasteToTag();
tests.focusTag();
PlacesOrganizer._places.controller.paste();
tests.historyNode();
tests.checkForBookmarkInUI();
@ -56,7 +57,7 @@ function onClipboardReady() {
let tags = PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(TEST_URL));
is(tags.length, 0, "tags are gone");
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
waitForClearHistory(finish);
}
@ -80,25 +81,19 @@ let tests = {
is(tags[0], 'foo', "tag is foo");
},
focusTag: function (paste){
focusTag: function (){
// focus the new tag
PlacesOrganizer.selectLeftPaneQuery("Tags");
let tags = PlacesOrganizer._places.selectedNode;
tags.containerOpen = true;
let fooTag = tags.getChild(0);
this.tagNode = fooTag;
let tagNode = fooTag;
PlacesOrganizer._places.selectNode(fooTag);
is(this.tagNode.title, 'foo', "tagNode title is foo");
is(tagNode.title, 'foo', "tagNode title is foo");
let ip = PlacesOrganizer._places.insertionPoint;
ok(ip.isTag, "IP is a tag");
if (paste) {
ok(true, "About to paste");
PlacesOrganizer._places.controller.paste();
}
},
histNode: null,
copyHistNode: function (){
// focus the history object
PlacesOrganizer.selectLeftPaneQuery("History");
@ -106,19 +101,14 @@ let tests = {
PlacesUtils.asContainer(histContainer);
histContainer.containerOpen = true;
PlacesOrganizer._places.selectNode(histContainer.getChild(0));
this.histNode = PlacesOrganizer._content.view.nodeForTreeIndex(0);
PlacesOrganizer._content.selectNode(this.histNode);
is(this.histNode.uri, MOZURISPEC,
"historyNode exists: " + this.histNode.uri);
let histNode = PlacesOrganizer._content.view.nodeForTreeIndex(0);
PlacesOrganizer._content.selectNode(histNode);
is(histNode.uri, MOZURISPEC,
"historyNode exists: " + histNode.uri);
// copy the history node
PlacesOrganizer._content.controller.copy();
},
pasteToTag: function (){
// paste history node into tag
this.focusTag(true);
},
historyNode: function (){
// re-focus the history again
PlacesOrganizer.selectLeftPaneQuery("History");
@ -148,8 +138,6 @@ let tests = {
ok(unsortedNode, "unsortedNode is not null: " + unsortedNode.uri);
is(unsortedNode.uri, MOZURISPEC, "node uri's are the same");
},
tagNode: null,
};
/**

View File

@ -185,7 +185,7 @@ SessionStoreService.prototype = {
// xul:tab attributes to (re)store (extensions might want to hook in here);
// the favicon is always saved for the about:sessionrestore page
xulAttributes: ["image"],
xulAttributes: {"image": true},
// set default load state
_loadState: STATE_STOPPED,
@ -498,6 +498,7 @@ SessionStoreService.prototype = {
// quit-application notification so the browser is about to exit.
if (this._loadState == STATE_QUITTING)
return;
this._lastSessionState = null;
let openWindows = {};
this._forEachBrowserWindow(function(aWindow) {
Array.forEach(aWindow.gBrowser.tabs, function(aTab) {
@ -639,15 +640,16 @@ SessionStoreService.prototype = {
let quitting = aSubject.data;
if (quitting) {
// save the backed up state with session set to stopped,
// otherwise resuming next time would look like a crash
// otherwise resuming next time would look like a crash.
// Whether we restore the session upon resume will be determined by the
// usual startup prefs, so we will have the same behavior regardless of
// whether the browser was closed while in normal or private browsing mode.
if ("_stateBackup" in this) {
var oState = this._stateBackup;
oState.session = { state: STATE_STOPPED_STR };
this._saveStateObject(oState);
}
// make sure to restore the non-private session upon resuming
this._prefBranch.setBoolPref("sessionstore.resume_session_once", true);
}
else
this._inPrivateBrowsing = false;
@ -1426,10 +1428,10 @@ SessionStoreService.prototype = {
},
persistTabAttribute: function sss_persistTabAttribute(aName) {
if (this.xulAttributes.indexOf(aName) != -1)
if (aName in this.xulAttributes)
return; // this attribute is already being tracked
this.xulAttributes.push(aName);
this.xulAttributes[aName] = true;
this.saveStateDelayed();
},
@ -1736,12 +1738,10 @@ SessionStoreService.prototype = {
else if (tabData.disallow)
delete tabData.disallow;
if (this.xulAttributes.length > 0) {
tabData.attributes = {};
Array.forEach(aTab.attributes, function(aAttr) {
if (this.xulAttributes.indexOf(aAttr.name) > -1)
tabData.attributes[aAttr.name] = aAttr.value;
}, this);
tabData.attributes = {};
for (let name in this.xulAttributes) {
if (aTab.hasAttribute(name))
tabData.attributes[name] = aTab.getAttribute(name);
}
if (aTab.__SS_extdata)
@ -1913,7 +1913,15 @@ SessionStoreService.prototype = {
let hasContent = false;
for (let i = 0; i < aHistory.count; i++) {
let uri = aHistory.getEntryAtIndex(i, false).URI;
let uri;
try {
uri = aHistory.getEntryAtIndex(i, false).URI;
}
catch (ex) {
// Chances are that this is getEntryAtIndex throwing, as seen in bug 669196.
// We've already asserted in _collectTabData, so we won't show that again.
continue;
}
// sessionStorage is saved per origin (cf. nsDocShell::GetSessionStorageForURI)
let domain = uri.spec;
try {
@ -2748,6 +2756,9 @@ SessionStoreService.prototype = {
else
tabbrowser.showTab(tab);
for (let name in tabData.attributes)
this.xulAttributes[name] = true;
tabData._tabStillLoading = true;
// keep the data around to prevent dataloss in case
@ -2863,9 +2874,8 @@ SessionStoreService.prototype = {
CAPABILITIES.forEach(function(aCapability) {
browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
});
Array.filter(tab.attributes, function(aAttr) {
return (_this.xulAttributes.indexOf(aAttr.name) > -1);
}).forEach(tab.removeAttribute, tab);
for (let name in this.xulAttributes)
tab.removeAttribute(name);
for (let name in tabData.attributes)
tab.setAttribute(name, tabData.attributes[name]);

View File

@ -55,10 +55,10 @@ import sys
from fnmatch import fnmatch
from optparse import OptionParser
version = '0.5.2' # package version
version = '0.5.3' # package version
try:
from setuptools import setup
except ImportError:
except:
setup = None
# we need relpath, but it is introduced in python 2.6

View File

@ -79,6 +79,12 @@ class RemoteAutomation(Automation):
if env is None:
env = {}
# Except for the mochitest results table hiding option, which isn't
# passed to runtestsremote.py as an actual option, but through the
# MOZ_CRASHREPORTER_DISABLE environment variable.
if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
if crashreporter:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'

Binary file not shown.

View File

@ -0,0 +1,16 @@
# Locally defined URLs
content test1 test/
locale test1 en-US test/
skin test1 test test/
# Test Override
content testOverride test/
override chrome://testOverride/content file:///test1/override
# Load external manifest
manifest loaded.manifest
# Failure Cases
overlay chrome://test1/content/overlay.xul chrome://test1/content/test1.xul
style chrome://test1/content/style.xul chrome://test1/content/test1.css

View File

@ -0,0 +1,2 @@
content test2 test/
locale test2 en-US test/

View File

@ -0,0 +1,155 @@
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
*
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Hernan Rodriguez Colmeiro <colmeiro@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 *****
*/
const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");
var gIOS = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).
QueryInterface(Ci.nsIXULOverlayProvider);
/*
* Checks that a mapping was added
*/
function test_mapping(chromeURL, target) {
var uri = gIOS.newURI(chromeURL, null, null);
try {
var result = gCR.convertChromeURL(uri);
do_check_eq(result.spec, target);
}
catch (ex) {
do_throw(chromeURL + " not Registered");
}
}
/*
* Checks that a mapping was removed
*/
function test_removed_mapping(chromeURL, target) {
var uri = gIOS.newURI(chromeURL, null, null);
try {
var result = gCR.convertChromeURL(uri);
do_throw(chromeURL + " not removed");
}
catch (ex) {
// This should throw
}
}
/*
* Checks if any overlay was added after loading
* the manifest files
*
* @param type The type of overlay: overlay|style
*/
function test_no_overlays(chromeURL, target, type) {
var type = type || "overlay";
var uri = gIOS.newURI(chromeURL, null, null);
var present = false, elem;
var overlays = (type == "overlay") ?
gCR.getXULOverlays(uri) : gCR.getStyleOverlays(uri);
// We shouldn't be allowed to register overlays nor styles
if (overlays.hasMoreElements()) {
if (type == "styles")
do_throw("Style Registered: " + chromeURL);
else
do_throw("Overlay Registered: " + chromeURL);
}
}
function testManifest(manifestPath, baseURI) {
// ------------------ Add manifest file ------------------------
Components.manager.addBootstrappedManifestLocation(manifestPath);
// Test Adding Content URL
test_mapping("chrome://test1/content", baseURI + "test/test1.xul");
// Test Adding Locale URL
test_mapping("chrome://test1/locale", baseURI + "test/test1.dtd");
// Test Adding Skin URL
test_mapping("chrome://test1/skin", baseURI + "test/test1.css");
// Test Adding Manifest URL
test_mapping("chrome://test2/content", baseURI + "test/test2.xul");
test_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
// Test Adding Override
test_mapping("chrome://testOverride/content", 'file:///test1/override')
// Test Not-Adding Overlays
test_no_overlays("chrome://test1/content/overlay.xul",
"chrome://test1/content/test1.xul");
// Test Not-Adding Styles
test_no_overlays("chrome://test1/content/style.xul",
"chrome://test1/content/test1.css", "styles");
// ------------------ Remove manifest file ------------------------
Components.manager.removeBootstrappedManifestLocation(manifestPath);
// Test Removing Content URL
test_removed_mapping("chrome://test1/content", baseURI + "test/test1.xul");
// Test Removing Content URL
test_removed_mapping("chrome://test1/locale", baseURI + "test/test1.dtd");
// Test Removing Skin URL
test_removed_mapping("chrome://test1/skin", baseURI + "test/test1.css");
// Test Removing Manifest URL
test_removed_mapping("chrome://test2/content", baseURI + "test/test2.xul");
test_removed_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
}
function run_test() {
// Test an unpackaged addon
testManifest(UNPACKAGED_ADDON, gIOS.newFileURI(UNPACKAGED_ADDON).spec);
// Test a packaged addon
testManifest(PACKAGED_ADDON, "jar:" + gIOS.newFileURI(PACKAGED_ADDON).spec + "!/");
}

View File

@ -10,6 +10,7 @@ tail =
[test_bug401153.js]
[test_bug415367.js]
[test_bug519468.js]
[test_bug564667.js]
[test_crlf.js]
[test_data_protocol_registration.js]
[test_no_remote_registration.js]

View File

@ -192,7 +192,7 @@ ifdef CPP_UNIT_TESTS
CPPSRCS += $(CPP_UNIT_TESTS)
SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
INCLUDES += -I$(DIST)/include/testing
LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS) $(MOZ_JS_LIBS)
# ...and run them the usual way
check::

View File

@ -1874,10 +1874,11 @@ dnl ========================================================
dnl callgrind
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(callgrind,
[ --enable-callgrind Enable callgrind profiling],
[ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
MOZ_CALLGRIND=1,
MOZ_CALLGRIND= )
if test -n "$MOZ_CALLGRIND"; then
MOZ_PROFILING=1
AC_DEFINE(MOZ_CALLGRIND)
fi
@ -4287,8 +4288,11 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
fi
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
# linking XUL.
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
AC_CACHE_CHECK(for __thread keyword for TLS variables,
ac_cv_thread_keyword,
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
@ -7549,7 +7553,7 @@ else
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q __imp__\{0,1\}free crtdll.obj; then
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'

View File

@ -77,6 +77,7 @@ nsContentCreatorFunctions.h \
nsDOMFile.h \
nsLineBreaker.h \
nsReferencedElement.h \
nsTreeSanitizer.h \
nsXMLNameSpaceMap.h \
nsDOMEventTargetWrapperCache.h \
$(NULL)

View File

@ -153,14 +153,6 @@
#define NS_HTMLFRAGMENTSINK2_CID \
{ 0x13111d00, 0xce81, 0x11d6, { 0x80, 0x82, 0xec, 0xf3, 0x66, 0x5a, 0xf6, 0x7c } }
// {A47E9526-6E48-4574-9D6C-3164E271F74E}
#define NS_HTMLPARANOIDFRAGMENTSINK_CID \
{ 0xa47e9526, 0x6e48, 0x4574, { 0x9d, 0x6c, 0x31, 0x64, 0xe2, 0x71, 0xf7, 0x4e } }
// {35aab9d8-db42-4c82-8aba-fad2b1d8f465}
#define NS_HTMLPARANOIDFRAGMENTSINK2_CID \
{ 0x35aab9d8, 0xdb42, 0x4c82, { 0x8a, 0xba, 0xfa, 0xd2, 0xb1, 0xd8, 0xf4, 0x65 } }
// {4B664E54-72A2-4bbf-A5C2-66D4DC3066A0}
#define NS_XMLFRAGMENTSINK_CID \
{ 0x4b664e54, 0x72a2, 0x4bbf, { 0xa5, 0xc2, 0x66, 0xd4, 0xdc, 0x30, 0x66, 0xa0 } }
@ -169,14 +161,6 @@
#define NS_XMLFRAGMENTSINK2_CID \
{ 0x4dc30689, 0x929d, 0x425e, { 0xa7, 0x9, 0x8, 0x2c, 0x62, 0x94, 0xe5, 0x42 } }
// {2D78BBF0-E26C-482B-92B3-78A7B2AFC8F7}
#define NS_XHTMLPARANOIDFRAGMENTSINK_CID \
{ 0x2d78bbf0, 0xe26c, 0x482b, { 0x92, 0xb3, 0x78, 0xa7, 0xb2, 0xaf, 0xc8, 0xf7} }
// {921dac9c-ffd4-4b5c-9901-4015b03862e6}
#define NS_XHTMLPARANOIDFRAGMENTSINK2_CID \
{ 0x921dac9c, 0xffd4, 0x4b5c, { 0x99, 0x01, 0x40, 0x15, 0xb0, 0x38, 0x62, 0xe6} }
// {3986B301-097C-11d3-BF87-00105A1B0627}
#define NS_XULPOPUPLISTENER_CID \
{ 0x3986b301, 0x97c, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }

View File

@ -80,6 +80,9 @@ static fp_except_t oldmask = fpsetmask(~allmask);
#include "nsINode.h"
#include "nsHashtable.h"
#include "nsIDOMNode.h"
#include "nsAHtml5FragmentParser.h"
#include "nsIFragmentContentSink.h"
#include "nsMathUtils.h"
struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
@ -1037,15 +1040,48 @@ public:
*
* @param aContextNode the node which is used to resolve namespaces
* @param aFragment the string which is parsed to a DocumentFragment
* @param aWillOwnFragment is PR_TRUE if ownership of the fragment should be
* transferred to the caller.
* @param aReturn [out] the created DocumentFragment
* @param aReturn the resulting fragment
* @param aPreventScriptExecution whether to mark scripts as already started
*/
static nsresult CreateContextualFragment(nsINode* aContextNode,
const nsAString& aFragment,
PRBool aWillOwnFragment,
PRBool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn);
/**
* Invoke the fragment parsing algorithm (innerHTML) using the HTML parser.
*
* @param aSourceBuffer the string being set as innerHTML
* @param aTargetNode the target container
* @param aContextLocalName local name of context node
* @param aContextNamespace namespace of context node
* @param aQuirks true to make <table> not close <p>
* @param aPreventScriptExecution true to prevent scripts from executing;
* don't set to false when parsing into a target node that has been
* bound to tree.
*/
static void ParseFragmentHTML(const nsAString& aSourceBuffer,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks,
PRBool aPreventScriptExecution);
/**
* Invoke the fragment parsing algorithm (innerHTML) using the XML parser.
*
* @param aSourceBuffer the string being set as innerHTML
* @param aTargetNode the target container
* @param aTagStack the namespace mapping context
* @param aPreventExecution whether to mark scripts as already started
* @param aReturn the result fragment
*/
static nsresult ParseFragmentXML(const nsAString& aSourceBuffer,
nsIDocument* aDocument,
nsTArray<nsString>& aTagStack,
PRBool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn);
/**
* Creates a new XML document, which is marked to be loaded as data.
*
@ -1664,6 +1700,12 @@ public:
*/
static PRBool IsFocusedContent(const nsIContent *aContent);
static void GetShiftText(nsAString& text);
static void GetControlText(nsAString& text);
static void GetMetaText(nsAString& text);
static void GetAltText(nsAString& text);
static void GetModifierSeparatorText(nsAString& text);
/**
* Returns if aContent has a tabbable subdocument.
* A sub document isn't tabbable when it's a zombie document.
@ -1688,6 +1730,11 @@ public:
*/
static bool AllowXULXBLForPrincipal(nsIPrincipal* aPrincipal);
/**
* Perform cleanup that's appropriate for XPCOM shutdown.
*/
static void XPCOMShutdown();
enum ContentViewerType
{
TYPE_UNSUPPORTED,
@ -1750,6 +1797,10 @@ private:
nsIXPConnectJSObjectHolder** aHolder,
PRBool aAllowWrapping);
static void InitializeModifierStrings();
static void DropFragmentParsers();
static nsIDOMScriptObjectFactory *sDOMScriptObjectFactory;
static nsIXPConnect *sXPConnect;
@ -1812,6 +1863,16 @@ private:
static PRBool sIsHandlingKeyBoardEvent;
static PRBool sAllowXULXBL_for_file;
static nsAHtml5FragmentParser* sHTMLFragmentParser;
static nsIParser* sXMLFragmentParser;
static nsIFragmentContentSink* sXMLFragmentSink;
static nsString* sShiftText;
static nsString* sControlText;
static nsString* sMetaText;
static nsString* sAltText;
static nsString* sModifierSeparator;
};
#define NS_HOLD_JS_OBJECTS(obj, clazz) \
@ -1974,50 +2035,38 @@ public:
#define DOUBLE_COMPARE(LVAL, OP, RVAL) ((LVAL) OP (RVAL))
#endif
/*
* Check whether a floating point number is finite (not +/-infinity and not a
* NaN value).
*/
inline NS_HIDDEN_(PRBool) NS_FloatIsFinite(jsdouble f) {
#ifdef WIN32
return _finite(f);
#else
return finite(f);
#endif
}
/*
* In the following helper macros we exploit the fact that the result of a
* series of additions will not be finite if any one of the operands in the
* series is not finite.
*/
#define NS_ENSURE_FINITE(f, rv) \
if (!NS_FloatIsFinite(f)) { \
if (!NS_finite(f)) { \
return (rv); \
}
#define NS_ENSURE_FINITE2(f1, f2, rv) \
if (!NS_FloatIsFinite((f1)+(f2))) { \
if (!NS_finite((f1)+(f2))) { \
return (rv); \
}
#define NS_ENSURE_FINITE3(f1, f2, f3, rv) \
if (!NS_FloatIsFinite((f1)+(f2)+(f3))) { \
if (!NS_finite((f1)+(f2)+(f3))) { \
return (rv); \
}
#define NS_ENSURE_FINITE4(f1, f2, f3, f4, rv) \
if (!NS_FloatIsFinite((f1)+(f2)+(f3)+(f4))) { \
if (!NS_finite((f1)+(f2)+(f3)+(f4))) { \
return (rv); \
}
#define NS_ENSURE_FINITE5(f1, f2, f3, f4, f5, rv) \
if (!NS_FloatIsFinite((f1)+(f2)+(f3)+(f4)+(f5))) { \
if (!NS_finite((f1)+(f2)+(f3)+(f4)+(f5))) { \
return (rv); \
}
#define NS_ENSURE_FINITE6(f1, f2, f3, f4, f5, f6, rv) \
if (!NS_FloatIsFinite((f1)+(f2)+(f3)+(f4)+(f5)+(f6))) { \
if (!NS_finite((f1)+(f2)+(f3)+(f4)+(f5)+(f6))) { \
return (rv); \
}

View File

@ -126,8 +126,8 @@ class Element;
#define NS_IDOCUMENT_IID \
{ 0x18e4d4bd, 0x006b, 0x4008, \
{ 0x90, 0x05, 0x27, 0x57, 0x35, 0xf0, 0xd4, 0x85 } }
{ 0xfac563fb, 0x2b6a, 0x4ac8, \
{ 0x85, 0xf7, 0xd5, 0x14, 0x4b, 0x3e, 0xce, 0x78 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -1147,16 +1147,6 @@ public:
mMayStartLayout = aMayStartLayout;
}
// This method should return an addrefed nsIParser* or nsnull. Implementations
// should transfer ownership of the parser to the caller.
virtual already_AddRefed<nsIParser> GetFragmentParser() {
return nsnull;
}
virtual void SetFragmentParser(nsIParser* aParser) {
// Do nothing.
}
already_AddRefed<nsIDocumentEncoder> GetCachedEncoder()
{
return mCachedEncoder.forget();
@ -1386,7 +1376,8 @@ public:
* to nsPreloadURIs::PreloadURIs() in file nsParser.cpp whenever the
* parser-module is linked with gklayout-module.
*/
virtual void MaybePreLoadImage(nsIURI* uri) = 0;
virtual void MaybePreLoadImage(nsIURI* uri,
const nsAString& aCrossOriginAttr) = 0;
/**
* Called by nsParser to preload style sheets. Can also be merged into

View File

@ -1102,6 +1102,26 @@ public:
* null if there are no more nodes to traverse.
*/
nsIContent* GetNextNode(const nsINode* aRoot = nsnull) const
{
return GetNextNodeImpl(aRoot, PR_FALSE);
}
/**
* Get the next node in the pre-order tree traversal of the DOM but ignoring
* the children of this node. If aRoot is non-null, then it must be an
* ancestor of |this| (possibly equal to |this|) and only nodes that are
* descendants of aRoot, not including aRoot itself, will be returned.
* Returns null if there are no more nodes to traverse.
*/
nsIContent* GetNextNonChildNode(const nsINode* aRoot = nsnull) const
{
return GetNextNodeImpl(aRoot, PR_TRUE);
}
private:
nsIContent* GetNextNodeImpl(const nsINode* aRoot,
const PRBool aSkipChildren) const
{
// Can't use nsContentUtils::ContentIsDescendantOf here, since we
// can't include it here.
@ -1113,9 +1133,11 @@ public:
NS_ASSERTION(cur, "aRoot not an ancestor of |this|?");
}
#endif
nsIContent* kid = GetFirstChild();
if (kid) {
return kid;
if (!aSkipChildren) {
nsIContent* kid = GetFirstChild();
if (kid) {
return kid;
}
}
if (this == aRoot) {
return nsnull;
@ -1135,6 +1157,8 @@ public:
NS_NOTREACHED("How did we get here?");
}
public:
/**
* Get the previous nsIContent in the pre-order tree traversal of the DOM. If
* aRoot is non-null, then it must be an ancestor of |this|

View File

@ -49,6 +49,7 @@ class nsIFrame;
class nsIPresShell;
struct nsTextRangeStyle;
struct nsPoint;
#include "nsIFrame.h"
%}
[ptr] native nsFrameSelection(nsFrameSelection);
@ -56,6 +57,7 @@ struct nsPoint;
[ptr] native nsIPresShell(nsIPresShell);
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
[ref] native nsPointRef(nsPoint);
native nsDirection(nsDirection);
[scriptable, uuid(98552206-ad7a-4d2d-8ce3-b6fa2389298b)]
interface nsISelectionPrivate : nsISupports
@ -128,5 +130,11 @@ interface nsISelectionPrivate : nsISupports
*/
[noscript] void setTextRangeStyle(in nsIDOMRange range,
in constTextRangeStyleRef textRangeStyle);
/**
* Get the direction of the selection.
*/
[noscript, notxpcom] nsDirection getSelectionDirection();
[noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection);
};

View File

@ -0,0 +1,210 @@
/* ***** 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 HTML/SVG/MathML sanitizer code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Henri Sivonen <hsivonen@iki.fi>
*
* 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 nsTreeSanitizer_h_
#define nsTreeSanitizer_h_
#include "nsIContent.h"
#include "mozilla/css/StyleRule.h"
#include "nsIPrincipal.h"
#include "mozilla/dom/Element.h"
class NS_STACK_CLASS nsTreeSanitizer {
public:
/**
* The constructor.
*
* @param aAllowStyles Whether to allow <style> and style=""
* @param aAllowComments Whether to allow comment nodes
*/
nsTreeSanitizer(PRBool aAllowStyles, PRBool aAllowComments);
static void InitializeStatics();
static void ReleaseStatics();
/**
* Sanitizes a disconnected DOM fragment freshly obtained from a parser.
* The argument must be of type nsINode::eDOCUMENT_FRAGMENT and,
* consequently, must not be in the document. Furthermore, the fragment
* must have just come from a parser so that it can't have mutation
* event listeners set on it.
*/
void Sanitize(nsIContent* aFragment);
private:
/**
* Whether <style> and style="" are allowed.
*/
PRBool mAllowStyles;
/**
* Whether comment nodes are allowed.
*/
PRBool mAllowComments;
/**
* Queries if an element must be replaced with its children.
* @param aNamespace the namespace of the element the question is about
* @param aLocal the local name of the element the question is about
* @return true if the element must be replaced with its children and
* false if the element is to be kept
*/
PRBool MustFlatten(PRInt32 aNamespace, nsIAtom* aLocal);
/**
* Queries if an element including its children must be removed.
* @param aNamespace the namespace of the element the question is about
* @param aLocal the local name of the element the question is about
* @param aElement the element node itself for inspecting attributes
* @return true if the element and its children must be removed and
* false if the element is to be kept
*/
PRBool MustPrune(PRInt32 aNamespace,
nsIAtom* aLocal,
mozilla::dom::Element* aElement);
/**
* Checks if a given local name (for an attribute) is on the given list
* of URL attribute names.
* @param aURLs the list of URL attribute names
* @param aLocalName the name to search on the list
* @return true if aLocalName is on the aURLs list and false otherwise
*/
PRBool IsURL(nsIAtom*** aURLs, nsIAtom* aLocalName);
/**
* Removes dangerous attributes from the element. If the style attribute
* is allowed, its value is sanitized. The values of URL attributes are
* sanitized, except src isn't sanitized when it is allowed to remain
* potentially dangerous.
*
* @param aElement the element whose attributes should be sanitized
* @param aAllowed the whitelist of permitted local names to use
* @param aURLs the local names of URL-valued attributes
* @param aAllowXLink whether XLink attributes are allowed
* @param aAllowStyle whether the style attribute is allowed
* @param aAllowDangerousSrc whether to leave the value of the src
* attribute unsanitized
*/
void SanitizeAttributes(mozilla::dom::Element* aElement,
nsTHashtable<nsISupportsHashKey>* aAllowed,
nsIAtom*** aURLs,
PRBool aAllowXLink,
PRBool aAllowStyle,
PRBool aAllowDangerousSrc);
/**
* Remove the named URL attribute from the element if the URL fails a
* security check.
*
* @param aElement the element whose attribute to possibly modify
* @param aNamespace the namespace of the URL attribute
* @param aLocalName the local name of the URL attribute
*/
void SanitizeURL(mozilla::dom::Element* aElement,
PRInt32 aNamespace,
nsIAtom* aLocalName);
/**
* Checks a style rule for the presence of the 'binding' CSS property and
* removes that property from the rule and reserializes in case the
* property was found.
*
* @param aRule The style rule to check
* @param aRuleText the serialized mutated rule if the method returns true
* @return true if the rule was modified and false otherwise
*/
PRBool SanitizeStyleRule(mozilla::css::StyleRule* aRule,
nsAutoString &aRuleText);
/**
* Parses a style sheet and reserializes it with the 'binding' property
* removed if it was present.
*
* @param aOrigin the original style sheet source
* @param aSanitized the reserialization without 'binding'; only valid if
* this method return true
* @param aDocument the document the style sheet belongs to
* @param aBaseURI the base URI to use
* @return true if the 'binding' property was encountered and false
* otherwise
*/
PRBool SanitizeStyleSheet(const nsAString& aOriginal,
nsAString& aSanitized,
nsIDocument* aDocument,
nsIURI* aBaseURI);
/**
* The whitelist of HTML elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsHTML;
/**
* The whitelist of HTML attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesHTML;
/**
* The whitelist of SVG elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsSVG;
/**
* The whitelist of SVG attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesSVG;
/**
* The whitelist of SVG elements.
*/
static nsTHashtable<nsISupportsHashKey>* sElementsMathML;
/**
* The whitelist of MathML attributes.
*/
static nsTHashtable<nsISupportsHashKey>* sAttributesMathML;
/**
* Reusable null principal for URL checks.
*/
static nsIPrincipal* sNullPrincipal;
};
#endif // nsTreeSanitizer_h_

View File

@ -139,6 +139,7 @@ CPPSRCS = \
nsTextFragment.cpp \
nsTextNode.cpp \
nsTraversal.cpp \
nsTreeSanitizer.cpp \
nsTreeWalker.cpp \
nsWebSocket.cpp \
nsXHTMLContentSerializer.cpp \

View File

@ -103,6 +103,7 @@
#include "nsHTMLDNSPrefetch.h"
#include "nsISupportsPrimitives.h"
#include "mozilla/Preferences.h"
#include "nsParserConstants.h"
using namespace mozilla;
@ -335,6 +336,7 @@ nsContentSink::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
PRBool aWasAlternate,
nsresult aStatus)
{
NS_ASSERTION(!mFragmentMode, "How come a fragment parser observed sheets?");
if (!aWasAlternate) {
NS_ASSERTION(mPendingSheetCount > 0, "How'd that happen?");
--mPendingSheetCount;
@ -641,7 +643,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
while (*end != kNullCh && *end != kSemicolon && *end != kComma) {
PRUnichar ch = *end;
if (ch == kApostrophe || ch == kQuote || ch == kLessThan) {
if (ch == kQuote || ch == kLessThan) {
// quoted string
PRUnichar quote = ch;
@ -723,8 +725,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
value++;
}
if (((*value == kApostrophe) || (*value == kQuote)) &&
(*value == *last)) {
if ((*value == kQuote) && (*value == *last)) {
*last = kNullCh;
value++;
}
@ -874,12 +875,13 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
return NS_OK;
}
// If this is a fragment parser, we don't want to observe.
PRBool isAlternate;
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, aAlternate,
this, &isAlternate);
mFragmentMode ? nsnull : this, &isAlternate);
NS_ENSURE_SUCCESS(rv, rv);
if (!isAlternate) {
if (!isAlternate && !mFragmentMode) {
++mPendingSheetCount;
mScriptLoader->AddExecuteBlocker();
}
@ -1727,266 +1729,3 @@ nsContentSink::NotifyDocElementCreated(nsIDocument* aDoc)
EmptyString().get());
}
}
// URIs: action, href, src, longdesc, usemap, cite
PRBool
IsAttrURI(nsIAtom *aName)
{
return (aName == nsGkAtoms::action ||
aName == nsGkAtoms::href ||
aName == nsGkAtoms::src ||
aName == nsGkAtoms::longdesc ||
aName == nsGkAtoms::usemap ||
aName == nsGkAtoms::cite ||
aName == nsGkAtoms::background);
}
//
// these two lists are used by the sanitizing fragment serializers
// Thanks to Mark Pilgrim and Sam Ruby for the initial whitelist
//
nsIAtom** const kDefaultAllowedTags [] = {
&nsGkAtoms::a,
&nsGkAtoms::abbr,
&nsGkAtoms::acronym,
&nsGkAtoms::address,
&nsGkAtoms::area,
&nsGkAtoms::article,
&nsGkAtoms::aside,
#ifdef MOZ_MEDIA
&nsGkAtoms::audio,
#endif
&nsGkAtoms::b,
&nsGkAtoms::bdo,
&nsGkAtoms::big,
&nsGkAtoms::blockquote,
&nsGkAtoms::br,
&nsGkAtoms::button,
&nsGkAtoms::canvas,
&nsGkAtoms::caption,
&nsGkAtoms::center,
&nsGkAtoms::cite,
&nsGkAtoms::code,
&nsGkAtoms::col,
&nsGkAtoms::colgroup,
&nsGkAtoms::command,
&nsGkAtoms::datalist,
&nsGkAtoms::dd,
&nsGkAtoms::del,
&nsGkAtoms::details,
&nsGkAtoms::dfn,
&nsGkAtoms::dir,
&nsGkAtoms::div,
&nsGkAtoms::dl,
&nsGkAtoms::dt,
&nsGkAtoms::em,
&nsGkAtoms::fieldset,
&nsGkAtoms::figcaption,
&nsGkAtoms::figure,
&nsGkAtoms::font,
&nsGkAtoms::footer,
&nsGkAtoms::form,
&nsGkAtoms::h1,
&nsGkAtoms::h2,
&nsGkAtoms::h3,
&nsGkAtoms::h4,
&nsGkAtoms::h5,
&nsGkAtoms::h6,
&nsGkAtoms::header,
&nsGkAtoms::hgroup,
&nsGkAtoms::hr,
&nsGkAtoms::i,
&nsGkAtoms::img,
&nsGkAtoms::input,
&nsGkAtoms::ins,
&nsGkAtoms::kbd,
&nsGkAtoms::label,
&nsGkAtoms::legend,
&nsGkAtoms::li,
&nsGkAtoms::listing,
&nsGkAtoms::map,
&nsGkAtoms::mark,
&nsGkAtoms::menu,
&nsGkAtoms::meter,
&nsGkAtoms::nav,
&nsGkAtoms::nobr,
&nsGkAtoms::noscript,
&nsGkAtoms::ol,
&nsGkAtoms::optgroup,
&nsGkAtoms::option,
&nsGkAtoms::output,
&nsGkAtoms::p,
&nsGkAtoms::pre,
&nsGkAtoms::progress,
&nsGkAtoms::q,
&nsGkAtoms::rp,
&nsGkAtoms::rt,
&nsGkAtoms::ruby,
&nsGkAtoms::s,
&nsGkAtoms::samp,
&nsGkAtoms::section,
&nsGkAtoms::select,
&nsGkAtoms::small,
#ifdef MOZ_MEDIA
&nsGkAtoms::source,
#endif
&nsGkAtoms::span,
&nsGkAtoms::strike,
&nsGkAtoms::strong,
&nsGkAtoms::sub,
&nsGkAtoms::summary,
&nsGkAtoms::sup,
&nsGkAtoms::table,
&nsGkAtoms::tbody,
&nsGkAtoms::td,
&nsGkAtoms::textarea,
&nsGkAtoms::tfoot,
&nsGkAtoms::th,
&nsGkAtoms::thead,
&nsGkAtoms::time,
&nsGkAtoms::tr,
&nsGkAtoms::track,
&nsGkAtoms::tt,
&nsGkAtoms::u,
&nsGkAtoms::ul,
&nsGkAtoms::var,
#ifdef MOZ_MEDIA
&nsGkAtoms::video,
#endif
&nsGkAtoms::wbr,
nsnull
};
nsIAtom** const kDefaultAllowedAttributes [] = {
&nsGkAtoms::abbr,
&nsGkAtoms::accept,
&nsGkAtoms::acceptcharset,
&nsGkAtoms::accesskey,
&nsGkAtoms::action,
&nsGkAtoms::align,
&nsGkAtoms::alt,
&nsGkAtoms::autocomplete,
&nsGkAtoms::autofocus,
#ifdef MOZ_MEDIA
&nsGkAtoms::autoplay,
#endif
&nsGkAtoms::axis,
&nsGkAtoms::background,
&nsGkAtoms::bgcolor,
&nsGkAtoms::border,
&nsGkAtoms::cellpadding,
&nsGkAtoms::cellspacing,
&nsGkAtoms::_char,
&nsGkAtoms::charoff,
&nsGkAtoms::charset,
&nsGkAtoms::checked,
&nsGkAtoms::cite,
&nsGkAtoms::_class,
&nsGkAtoms::clear,
&nsGkAtoms::cols,
&nsGkAtoms::colspan,
&nsGkAtoms::color,
&nsGkAtoms::contenteditable,
&nsGkAtoms::contextmenu,
#ifdef MOZ_MEDIA
&nsGkAtoms::controls,
#endif
&nsGkAtoms::compact,
&nsGkAtoms::coords,
&nsGkAtoms::datetime,
&nsGkAtoms::dir,
&nsGkAtoms::disabled,
&nsGkAtoms::draggable,
&nsGkAtoms::enctype,
&nsGkAtoms::face,
&nsGkAtoms::_for,
&nsGkAtoms::frame,
&nsGkAtoms::headers,
&nsGkAtoms::height,
&nsGkAtoms::hidden,
&nsGkAtoms::high,
&nsGkAtoms::href,
&nsGkAtoms::hreflang,
&nsGkAtoms::hspace,
&nsGkAtoms::icon,
&nsGkAtoms::id,
&nsGkAtoms::ismap,
&nsGkAtoms::itemid,
&nsGkAtoms::itemprop,
&nsGkAtoms::itemref,
&nsGkAtoms::itemscope,
&nsGkAtoms::itemtype,
&nsGkAtoms::kind,
&nsGkAtoms::label,
&nsGkAtoms::lang,
&nsGkAtoms::list,
&nsGkAtoms::longdesc,
#ifdef MOZ_MEDIA
&nsGkAtoms::loop,
&nsGkAtoms::loopend,
&nsGkAtoms::loopstart,
#endif
&nsGkAtoms::low,
&nsGkAtoms::max,
&nsGkAtoms::maxlength,
&nsGkAtoms::media,
&nsGkAtoms::method,
&nsGkAtoms::min,
&nsGkAtoms::mozdonotsend,
&nsGkAtoms::multiple,
&nsGkAtoms::name,
&nsGkAtoms::nohref,
&nsGkAtoms::noshade,
&nsGkAtoms::novalidate,
&nsGkAtoms::nowrap,
&nsGkAtoms::open,
&nsGkAtoms::optimum,
&nsGkAtoms::pattern,
#ifdef MOZ_MEDIA
&nsGkAtoms::pixelratio,
#endif
&nsGkAtoms::placeholder,
#ifdef MOZ_MEDIA
&nsGkAtoms::playbackrate,
&nsGkAtoms::playcount,
#endif
&nsGkAtoms::pointSize,
#ifdef MOZ_MEDIA
&nsGkAtoms::poster,
&nsGkAtoms::preload,
#endif
&nsGkAtoms::prompt,
&nsGkAtoms::pubdate,
&nsGkAtoms::radiogroup,
&nsGkAtoms::readonly,
&nsGkAtoms::rel,
&nsGkAtoms::required,
&nsGkAtoms::rev,
&nsGkAtoms::reversed,
&nsGkAtoms::role,
&nsGkAtoms::rows,
&nsGkAtoms::rowspan,
&nsGkAtoms::rules,
&nsGkAtoms::scoped,
&nsGkAtoms::scope,
&nsGkAtoms::selected,
&nsGkAtoms::shape,
&nsGkAtoms::size,
&nsGkAtoms::span,
&nsGkAtoms::spellcheck,
&nsGkAtoms::src,
&nsGkAtoms::srclang,
&nsGkAtoms::start,
&nsGkAtoms::summary,
&nsGkAtoms::tabindex,
&nsGkAtoms::target,
&nsGkAtoms::title,
&nsGkAtoms::type,
&nsGkAtoms::usemap,
&nsGkAtoms::valign,
&nsGkAtoms::value,
&nsGkAtoms::vspace,
&nsGkAtoms::width,
&nsGkAtoms::wrap,
nsnull
};

View File

@ -349,6 +349,8 @@ protected:
PRUint8 mIsDocumentObserver : 1;
// True if this is a fragment parser
PRUint8 mFragmentMode : 1;
// True to call prevent script execution in the fragment mode.
PRUint8 mPreventScriptExecution : 1;
//
// -- Can interrupt parsing members --
@ -407,9 +409,4 @@ protected:
static PRBool sCanInterruptParser;
};
// sanitizing content sink whitelists
extern PRBool IsAttrURI(nsIAtom *aName);
extern nsIAtom** const kDefaultAllowedTags [];
extern nsIAtom** const kDefaultAllowedAttributes [];
#endif // _nsContentSink_h_

View File

@ -202,6 +202,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsHTMLMediaElement.h"
#endif
#include "nsDOMTouchEvent.h"
#include "nsIScriptElement.h"
#include "mozilla/Preferences.h"
@ -256,8 +257,18 @@ nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nsnull;
PRBool nsContentUtils::sIsHandlingKeyBoardEvent = PR_FALSE;
PRBool nsContentUtils::sAllowXULXBL_for_file = PR_FALSE;
nsString* nsContentUtils::sShiftText = nsnull;
nsString* nsContentUtils::sControlText = nsnull;
nsString* nsContentUtils::sMetaText = nsnull;
nsString* nsContentUtils::sAltText = nsnull;
nsString* nsContentUtils::sModifierSeparator = nsnull;
PRBool nsContentUtils::sInitialized = PR_FALSE;
nsAHtml5FragmentParser* nsContentUtils::sHTMLFragmentParser = nsnull;
nsIParser* nsContentUtils::sXMLFragmentParser = nsnull;
nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nsnull;
static PLDHashTable sEventListenerManagersHash;
class EventListenerManagerMapEntry : public PLDHashEntryHdr
@ -382,6 +393,81 @@ nsContentUtils::Init()
return NS_OK;
}
void
nsContentUtils::GetShiftText(nsAString& text)
{
if (!sShiftText)
InitializeModifierStrings();
text.Assign(*sShiftText);
}
void
nsContentUtils::GetControlText(nsAString& text)
{
if (!sControlText)
InitializeModifierStrings();
text.Assign(*sControlText);
}
void
nsContentUtils::GetMetaText(nsAString& text)
{
if (!sMetaText)
InitializeModifierStrings();
text.Assign(*sMetaText);
}
void
nsContentUtils::GetAltText(nsAString& text)
{
if (!sAltText)
InitializeModifierStrings();
text.Assign(*sAltText);
}
void
nsContentUtils::GetModifierSeparatorText(nsAString& text)
{
if (!sModifierSeparator)
InitializeModifierStrings();
text.Assign(*sModifierSeparator);
}
void
nsContentUtils::InitializeModifierStrings()
{
//load the display strings for the keyboard accelerators
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
nsCOMPtr<nsIStringBundle> bundle;
nsresult rv = NS_OK;
if (bundleService) {
rv = bundleService->CreateBundle( "chrome://global-platform/locale/platformKeys.properties",
getter_AddRefs(bundle));
}
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded");
nsXPIDLString shiftModifier;
nsXPIDLString metaModifier;
nsXPIDLString altModifier;
nsXPIDLString controlModifier;
nsXPIDLString modifierSeparator;
if (bundle) {
//macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
bundle->GetStringFromName(NS_LITERAL_STRING("VK_SHIFT").get(), getter_Copies(shiftModifier));
bundle->GetStringFromName(NS_LITERAL_STRING("VK_META").get(), getter_Copies(metaModifier));
bundle->GetStringFromName(NS_LITERAL_STRING("VK_ALT").get(), getter_Copies(altModifier));
bundle->GetStringFromName(NS_LITERAL_STRING("VK_CONTROL").get(), getter_Copies(controlModifier));
bundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(), getter_Copies(modifierSeparator));
}
//if any of these don't exist, we get an empty string
sShiftText = new nsString(shiftModifier);
sMetaText = new nsString(metaModifier);
sAltText = new nsString(altModifier);
sControlText = new nsString(controlModifier);
sModifierSeparator = new nsString(modifierSeparator);
}
bool nsContentUtils::sImgLoaderInitialized;
void
@ -1087,9 +1173,6 @@ nsContentUtils::Shutdown()
{
sInitialized = PR_FALSE;
NS_HTMLParanoidFragmentSinkShutdown();
NS_XHTMLParanoidFragmentSinkShutdown();
NS_IF_RELEASE(sContentPolicyService);
sTriedToGetContentPolicy = PR_FALSE;
PRUint32 i;
@ -1149,6 +1232,17 @@ nsContentUtils::Shutdown()
delete sBlockedScriptRunners;
sBlockedScriptRunners = nsnull;
delete sShiftText;
sShiftText = nsnull;
delete sControlText;
sControlText = nsnull;
delete sMetaText;
sMetaText = nsnull;
delete sAltText;
sAltText = nsnull;
delete sModifierSeparator;
sModifierSeparator = nsnull;
NS_IF_RELEASE(sSameOriginChecker);
nsTextEditorState::ShutDown();
@ -3517,14 +3611,12 @@ nsContentUtils::IsValidNodeName(nsIAtom *aLocalName, nsIAtom *aPrefix,
nsresult
nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
const nsAString& aFragment,
PRBool aWillOwnFragment,
PRBool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn)
{
*aReturn = nsnull;
NS_ENSURE_ARG(aContextNode);
nsresult rv;
// If we don't have a document here, we can't get the right security context
// for compiling event handlers... so just bail out.
nsCOMPtr<nsIDocument> document = aContextNode->GetOwnerDoc();
@ -3536,24 +3628,9 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
NS_ASSERTION(!isHTML || htmlDoc, "Should have HTMLDocument here!");
#endif
if (isHTML && nsHtml5Module::sEnabled) {
// See if the document has a cached fragment parser. nsHTMLDocument is the
// only one that should really have one at the moment.
nsCOMPtr<nsIParser> parser = document->GetFragmentParser();
if (parser) {
// Get the parser ready to use.
parser->Reset();
}
else {
// Create a new parser for this operation.
parser = nsHtml5Module::NewHtml5Parser();
if (!parser) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
if (isHTML) {
nsCOMPtr<nsIDOMDocumentFragment> frag;
rv = NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
NS_ENSURE_SUCCESS(rv, rv);
NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
nsCOMPtr<nsIContent> contextAsContent = do_QueryInterface(aContextNode);
if (contextAsContent && !contextAsContent->IsElement()) {
@ -3564,31 +3641,26 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
}
}
nsAHtml5FragmentParser* asFragmentParser =
static_cast<nsAHtml5FragmentParser*> (parser.get());
nsCOMPtr<nsIContent> fragment = do_QueryInterface(frag);
if (contextAsContent &&
!(nsGkAtoms::html == contextAsContent->Tag() &&
contextAsContent->IsHTML())) {
asFragmentParser->ParseHtml5Fragment(aFragment,
fragment,
contextAsContent->Tag(),
contextAsContent->GetNameSpaceID(),
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
PR_FALSE);
if (contextAsContent && !contextAsContent->IsHTML(nsGkAtoms::html)) {
ParseFragmentHTML(aFragment,
fragment,
contextAsContent->Tag(),
contextAsContent->GetNameSpaceID(),
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
aPreventScriptExecution);
} else {
asFragmentParser->ParseHtml5Fragment(aFragment,
fragment,
nsGkAtoms::body,
kNameSpaceID_XHTML,
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
PR_FALSE);
ParseFragmentHTML(aFragment,
fragment,
nsGkAtoms::body,
kNameSpaceID_XHTML,
(document->GetCompatibilityMode() ==
eCompatibility_NavQuirks),
aPreventScriptExecution);
}
frag.swap(*aReturn);
document->SetFragmentParser(parser);
frag.forget(aReturn);
return NS_OK;
}
@ -3647,84 +3719,94 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
content = content->GetParent();
}
nsCAutoString contentType;
nsAutoString buf;
document->GetContentType(buf);
LossyCopyUTF16toASCII(buf, contentType);
return ParseFragmentXML(aFragment,
document,
tagStack,
aPreventScriptExecution,
aReturn);
}
// See if the document has a cached fragment parser. nsHTMLDocument is the
// only one that should really have one at the moment.
nsCOMPtr<nsIParser> parser = document->GetFragmentParser();
if (parser) {
// Get the parser ready to use.
parser->Reset();
/* static */
void
nsContentUtils::DropFragmentParsers()
{
NS_IF_RELEASE(sHTMLFragmentParser);
NS_IF_RELEASE(sXMLFragmentParser);
NS_IF_RELEASE(sXMLFragmentSink);
}
/* static */
void
nsContentUtils::XPCOMShutdown()
{
nsContentUtils::DropFragmentParsers();
}
/* static */
void
nsContentUtils::ParseFragmentHTML(const nsAString& aSourceBuffer,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks,
PRBool aPreventScriptExecution)
{
if (!sHTMLFragmentParser) {
sHTMLFragmentParser =
static_cast<nsAHtml5FragmentParser*>(nsHtml5Module::NewHtml5Parser().get());
// Now sHTMLFragmentParser owns the object
}
else {
// Create a new parser for this operation.
parser = do_CreateInstance(kCParserCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
sHTMLFragmentParser->ParseHtml5Fragment(aSourceBuffer,
aTargetNode,
aContextLocalName,
aContextNamespace,
aQuirks,
aPreventScriptExecution);
sHTMLFragmentParser->Reset();
}
/* static */
nsresult
nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer,
nsIDocument* aDocument,
nsTArray<nsString>& aTagStack,
PRBool aPreventScriptExecution,
nsIDOMDocumentFragment** aReturn)
{
if (!sXMLFragmentParser) {
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID);
parser.forget(&sXMLFragmentParser);
// sXMLFragmentParser now owns the parser
}
if (!sXMLFragmentSink) {
NS_NewXMLFragmentContentSink(&sXMLFragmentSink);
// sXMLFragmentSink now owns the sink
}
nsCOMPtr<nsIContentSink> contentsink = do_QueryInterface(sXMLFragmentSink);
NS_ABORT_IF_FALSE(contentsink, "Sink doesn't QI to nsIContentSink!");
sXMLFragmentParser->SetContentSink(contentsink);
sXMLFragmentSink->SetTargetDocument(aDocument);
sXMLFragmentSink->SetPreventScriptExecution(aPreventScriptExecution);
nsresult rv =
sXMLFragmentParser->ParseFragment(aSourceBuffer,
aTagStack);
if (NS_FAILED(rv)) {
// Drop the fragment parser and sink that might be in an inconsistent state
NS_IF_RELEASE(sXMLFragmentParser);
NS_IF_RELEASE(sXMLFragmentSink);
return rv;
}
// See if the parser already has a content sink that we can reuse.
nsCOMPtr<nsIFragmentContentSink> sink;
nsCOMPtr<nsIContentSink> contentsink = parser->GetContentSink();
if (contentsink) {
// Make sure it's the correct type.
if (isHTML) {
nsCOMPtr<nsIHTMLContentSink> htmlsink = do_QueryInterface(contentsink);
sink = do_QueryInterface(htmlsink);
}
else {
nsCOMPtr<nsIXMLContentSink> xmlsink = do_QueryInterface(contentsink);
sink = do_QueryInterface(xmlsink);
}
}
rv = sXMLFragmentSink->FinishFragmentParsing(aReturn);
if (!sink) {
// Either there was no cached content sink or it was the wrong type. Make a
// new one.
if (isHTML) {
rv = NS_NewHTMLFragmentContentSink(getter_AddRefs(sink));
} else {
rv = NS_NewXMLFragmentContentSink(getter_AddRefs(sink));
}
NS_ENSURE_SUCCESS(rv, rv);
contentsink = do_QueryInterface(sink);
NS_ASSERTION(contentsink, "Sink doesn't QI to nsIContentSink!");
parser->SetContentSink(contentsink);
}
sink->SetTargetDocument(document);
nsDTDMode mode = eDTDMode_autodetect;
switch (document->GetCompatibilityMode()) {
case eCompatibility_NavQuirks:
mode = eDTDMode_quirks;
break;
case eCompatibility_AlmostStandards:
mode = eDTDMode_almost_standards;
break;
case eCompatibility_FullStandards:
mode = eDTDMode_full_standards;
break;
default:
NS_NOTREACHED("unknown mode");
break;
}
rv = parser->ParseFragment(aFragment, nsnull, tagStack,
!isHTML, contentType, mode);
if (NS_SUCCEEDED(rv)) {
rv = sink->GetFragment(aWillOwnFragment, aReturn);
}
document->SetFragmentParser(parser);
sXMLFragmentParser->Reset();
return rv;
}
/* static */
nsresult
nsContentUtils::CreateDocument(const nsAString& aNamespaceURI,

View File

@ -203,6 +203,8 @@
#include "mozilla/Preferences.h"
#include "imgILoader.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -7668,7 +7670,7 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
}
void
nsDocument::MaybePreLoadImage(nsIURI* uri)
nsDocument::MaybePreLoadImage(nsIURI* uri, const nsAString &aCrossOriginAttr)
{
// Early exit if the img is already present in the img-cache
// which indicates that the "real" load has already started and
@ -7680,6 +7682,16 @@ nsDocument::MaybePreLoadImage(nsIURI* uri)
return;
}
nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
if (aCrossOriginAttr.LowerCaseEqualsLiteral("anonymous")) {
loadFlags |= imgILoader::LOAD_CORS_ANONYMOUS;
} else if (aCrossOriginAttr.LowerCaseEqualsLiteral("use-credentials")) {
loadFlags |= imgILoader::LOAD_CORS_USE_CREDENTIALS;
}
// else should we err on the side of not doing the preload if
// aCrossOriginAttr is nonempty? Let's err on the side of doing the
// preload as CORS_NONE.
// Image not in cache - trigger preload
nsCOMPtr<imgIRequest> request;
nsresult rv =
@ -7688,7 +7700,7 @@ nsDocument::MaybePreLoadImage(nsIURI* uri)
NodePrincipal(),
mDocumentURI, // uri of document used as referrer
nsnull, // no observer
nsIRequest::LOAD_NORMAL,
loadFlags,
getter_AddRefs(request));
// Pin image-reference to avoid evicting it from the img-cache before
@ -8389,7 +8401,7 @@ PRInt64
nsDocument::SizeOf() const
{
PRInt64 size = MemoryReporter::GetBasicSize<nsDocument, nsIDocument>(this);
size += mAttrStyleSheet ? mAttrStyleSheet->SizeOf() : 0;
size += mAttrStyleSheet ? mAttrStyleSheet->DOMSizeOf() : 0;
return size;
}

View File

@ -885,7 +885,8 @@ public:
void MaybeEndOutermostXBLUpdate();
virtual void MaybePreLoadImage(nsIURI* uri);
virtual void MaybePreLoadImage(nsIURI* uri,
const nsAString &aCrossOriginAttr);
virtual void PreloadStyle(nsIURI* uri, const nsAString& charset);

View File

@ -4313,20 +4313,15 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
}
NS_PRECONDITION(aEventName, "Must have event name!");
nsCOMPtr<nsISupports> target;
PRBool defer = PR_TRUE;
nsRefPtr<nsEventListenerManager> manager;
GetEventListenerManagerForAttr(getter_AddRefs(manager),
getter_AddRefs(target),
&defer);
nsEventListenerManager* manager = GetEventListenerManagerForAttr(&defer);
if (!manager) {
return NS_OK;
}
defer = defer && aDefer; // only defer if everyone agrees...
PRUint32 lang = GetScriptTypeID();
manager->AddScriptEventListener(target, aEventName, aValue, lang, defer,
manager->AddScriptEventListener(aEventName, aValue, lang, defer,
!nsContentUtils::IsChromeDoc(ownerDoc));
return NS_OK;
}
@ -4595,17 +4590,11 @@ nsGenericElement::SetMappedAttribute(nsIDocument* aDocument,
return PR_FALSE;
}
nsresult
nsGenericElement::GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer)
nsEventListenerManager*
nsGenericElement::GetEventListenerManagerForAttr(PRBool* aDefer)
{
*aManager = GetListenerManager(PR_TRUE);
*aDefer = PR_TRUE;
NS_ENSURE_STATE(*aManager);
NS_ADDREF(*aManager);
NS_ADDREF(*aTarget = static_cast<nsIContent*>(this));
return NS_OK;
return GetListenerManager(PR_TRUE);
}
nsGenericElement::nsAttrInfo

View File

@ -784,10 +784,8 @@ protected:
* Hook to allow subclasses to produce a different nsEventListenerManager if
* needed for attachment of attribute-defined handlers
*/
virtual nsresult
GetEventListenerManagerForAttr(nsEventListenerManager** aManager,
nsISupports** aTarget,
PRBool* aDefer);
virtual nsEventListenerManager*
GetEventListenerManagerForAttr(PRBool* aDefer);
/**
* Copy attributes and state to another element

View File

@ -154,6 +154,7 @@ GK_ATOM(bordercolor, "bordercolor")
GK_ATOM(both, "both")
GK_ATOM(bottom, "bottom")
GK_ATOM(bottomend, "bottomend")
GK_ATOM(bottomstart, "bottomstart")
GK_ATOM(bottomleft, "bottomleft")
GK_ATOM(bottommargin, "bottommargin")
GK_ATOM(bottompadding, "bottompadding")

View File

@ -73,6 +73,7 @@
#include "nsIEditor.h"
#include "nsIHTMLEditor.h"
#include "mozilla/dom/Element.h"
#include "nsParserConstants.h"
using namespace mozilla::dom;

View File

@ -40,12 +40,12 @@
*/
#include "nsParserUtils.h"
#include "nsIParser.h" // for kQuote et. al.
#include "jsapi.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsContentUtils.h"
#include "nsIParserService.h"
#include "nsParserConstants.h"
#define SKIP_WHITESPACE(iter, end_iter, end_res) \
while ((iter) != (end_iter) && nsCRT::IsAsciiSpace(*(iter))) { \

View File

@ -2054,7 +2054,7 @@ nsRange::CreateContextualFragment(const nsAString& aFragment,
{
if (mIsPositioned) {
return nsContentUtils::CreateContextualFragment(mStartParent, aFragment,
PR_TRUE, aReturn);
PR_FALSE, aReturn);
}
return NS_ERROR_FAILURE;
}

File diff suppressed because it is too large Load Diff

View File

@ -68,6 +68,7 @@
#include "nsLWBrkCIID.h"
#include "nsIScriptElement.h"
#include "nsAttrName.h"
#include "nsParserConstants.h"
static const char kMozStr[] = "moz";

View File

@ -65,6 +65,7 @@
#include "nsAttrName.h"
#include "nsILineBreaker.h"
#include "mozilla/dom/Element.h"
#include "nsParserConstants.h"
using namespace mozilla::dom;

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