Skip to content

Commit

Permalink
Merge commit 'cfd536708f58670ae3b6e9811183641217b1a4ef' into embedlite
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Apr 28, 2014
2 parents 10e1a75 + cfd5367 commit 8bc8fda
Show file tree
Hide file tree
Showing 2,695 changed files with 76,038 additions and 33,210 deletions.
2 changes: 1 addition & 1 deletion CLOBBER
Expand Up @@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

Bug 916012 moves definition from one WEBIDL_FILE to another (Bug 979886)
Bug 995411 moves some files around in gfx/layers and widget/xpwidget
6 changes: 3 additions & 3 deletions accessible/src/base/AccEvent.cpp
Expand Up @@ -12,7 +12,7 @@
#include "States.h"

#include "mozilla/EventStateManager.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"

using namespace mozilla;
using namespace mozilla::a11y;
Expand Down Expand Up @@ -41,7 +41,7 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
////////////////////////////////////////////////////////////////////////////////
// AccEvent cycle collection

NS_IMPL_CYCLE_COLLECTION_1(AccEvent, mAccessible)
NS_IMPL_CYCLE_COLLECTION(AccEvent, mAccessible)

NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
Expand Down Expand Up @@ -127,7 +127,7 @@ AccShowEvent::
////////////////////////////////////////////////////////////////////////////////

AccTextSelChangeEvent::AccTextSelChangeEvent(HyperTextAccessible* aTarget,
Selection* aSelection,
dom::Selection* aSelection,
int32_t aReason) :
AccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED, aTarget,
eAutoDetect, eCoalesceTextSelChange),
Expand Down
7 changes: 5 additions & 2 deletions accessible/src/base/AccEvent.h
Expand Up @@ -12,7 +12,9 @@

namespace mozilla {

namespace dom {
class Selection;
}

namespace a11y {

Expand Down Expand Up @@ -367,7 +369,8 @@ class AccCaretMoveEvent: public AccEvent
class AccTextSelChangeEvent : public AccEvent
{
public:
AccTextSelChangeEvent(HyperTextAccessible* aTarget, Selection* aSelection,
AccTextSelChangeEvent(HyperTextAccessible* aTarget,
dom::Selection* aSelection,
int32_t aReason);
virtual ~AccTextSelChangeEvent();

Expand All @@ -386,7 +389,7 @@ class AccTextSelChangeEvent : public AccEvent
bool IsCaretMoveOnly() const;

private:
nsRefPtr<Selection> mSel;
nsRefPtr<dom::Selection> mSel;
int32_t mReason;

friend class EventQueue;
Expand Down
4 changes: 2 additions & 2 deletions accessible/src/base/NotificationController.cpp
Expand Up @@ -408,8 +408,8 @@ NotificationController::ContentInsertion::
return haveToUpdate;
}

NS_IMPL_CYCLE_COLLECTION_1(NotificationController::ContentInsertion,
mContainer)
NS_IMPL_CYCLE_COLLECTION(NotificationController::ContentInsertion,
mContainer)

NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(NotificationController::ContentInsertion,
AddRef)
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/base/SelectionManager.cpp
Expand Up @@ -14,11 +14,12 @@
#include "nsIAccessibleTypes.h"
#include "nsIDOMDocument.h"
#include "nsIPresShell.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"

using namespace mozilla;
using namespace mozilla::a11y;
using mozilla::dom::Selection;

struct mozilla::a11y::SelData MOZ_FINAL
{
Expand Down
12 changes: 12 additions & 0 deletions accessible/src/base/TextRange.cpp
Expand Up @@ -23,3 +23,15 @@ TextRange::Text(nsAString& aText) const
{

}

void
TextRange::Set(HyperTextAccessible* aRoot,
Accessible* aStartContainer, int32_t aStartOffset,
Accessible* aEndContainer, int32_t aEndOffset)
{
mRoot = aRoot;
mStartContainer = aStartContainer;
mEndContainer = aEndContainer;
mStartOffset = aStartOffset;
mEndOffset = aEndOffset;
}
21 changes: 18 additions & 3 deletions accessible/src/base/TextRange.h
Expand Up @@ -31,6 +31,16 @@ class TextRange MOZ_FINAL
mEndContainer(Move(aRange.mEndContainer)),
mStartOffset(aRange.mStartOffset), mEndOffset(aRange.mEndOffset) {}

TextRange& operator= (TextRange&& aRange)
{
mRoot = Move(aRange.mRoot);
mStartContainer = Move(aRange.mStartContainer);
mEndContainer = Move(aRange.mEndContainer);
mStartOffset = aRange.mStartOffset;
mEndOffset = aRange.mEndOffset;
return *this;
}

Accessible* StartContainer() const { return mStartContainer; }
int32_t StartOffset() const { return mStartOffset; }
Accessible* EndContainer() const { return mEndContainer; }
Expand All @@ -47,12 +57,17 @@ class TextRange MOZ_FINAL
bool IsValid() const { return mRoot; }

private:
TextRange(const TextRange& aRange) MOZ_DELETE;
TextRange& operator=(const TextRange& aRange) MOZ_DELETE;

friend class HyperTextAccessible;
friend class xpcAccessibleTextRange;

TextRange(const TextRange&) MOZ_DELETE;
TextRange& operator=(const TextRange&) MOZ_DELETE;
void Set(HyperTextAccessible* aRoot,
Accessible* aStartContainer, int32_t aStartOffset,
Accessible* aEndContainer, int32_t aEndOffset);

const nsRefPtr<HyperTextAccessible> mRoot;
nsRefPtr<HyperTextAccessible> mRoot;
nsRefPtr<Accessible> mStartContainer;
nsRefPtr<Accessible> mEndContainer;
int32_t mStartOffset;
Expand Down
8 changes: 7 additions & 1 deletion accessible/src/base/nsAccessibilityService.cpp
Expand Up @@ -1436,15 +1436,21 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,

if (tag == nsGkAtoms::abbr ||
tag == nsGkAtoms::acronym ||
tag == nsGkAtoms::article ||
tag == nsGkAtoms::aside ||
tag == nsGkAtoms::blockquote ||
tag == nsGkAtoms::form ||
tag == nsGkAtoms::footer ||
tag == nsGkAtoms::header ||
tag == nsGkAtoms::h1 ||
tag == nsGkAtoms::h2 ||
tag == nsGkAtoms::h3 ||
tag == nsGkAtoms::h4 ||
tag == nsGkAtoms::h5 ||
tag == nsGkAtoms::h6 ||
tag == nsGkAtoms::q) {
tag == nsGkAtoms::nav ||
tag == nsGkAtoms::q ||
tag == nsGkAtoms::section) {
nsRefPtr<Accessible> accessible =
new HyperTextAccessibleWrap(aContent, document);
return accessible.forget();
Expand Down
2 changes: 1 addition & 1 deletion accessible/src/base/nsAccessiblePivot.cpp
Expand Up @@ -48,7 +48,7 @@ nsAccessiblePivot::nsAccessiblePivot(Accessible* aRoot) :
////////////////////////////////////////////////////////////////////////////////
// nsISupports

NS_IMPL_CYCLE_COLLECTION_3(nsAccessiblePivot, mRoot, mPosition, mObservers)
NS_IMPL_CYCLE_COLLECTION(nsAccessiblePivot, mRoot, mPosition, mObservers)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessiblePivot)
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivot)
Expand Down
4 changes: 2 additions & 2 deletions accessible/src/generic/Accessible.cpp
Expand Up @@ -91,8 +91,8 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// Accessible: nsISupports and cycle collection

NS_IMPL_CYCLE_COLLECTION_3(Accessible,
mContent, mParent, mChildren)
NS_IMPL_CYCLE_COLLECTION(Accessible,
mContent, mParent, mChildren)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Accessible)
NS_INTERFACE_MAP_ENTRY(nsIAccessible)
Expand Down
4 changes: 2 additions & 2 deletions accessible/src/generic/HyperTextAccessible-inl.h
Expand Up @@ -42,7 +42,7 @@ HyperTextAccessible::IsValidRange(int32_t aStartOffset, int32_t aEndOffset)
inline bool
HyperTextAccessible::AddToSelection(int32_t aStartOffset, int32_t aEndOffset)
{
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
return domSel &&
SetSelectionBoundsAt(domSel->GetRangeCount(), aStartOffset, aEndOffset);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ HyperTextAccessible::FrameSelection() const
return frame ? frame->GetFrameSelection() : nullptr;
}

inline Selection*
inline dom::Selection*
HyperTextAccessible::DOMSelection() const
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
Expand Down
54 changes: 46 additions & 8 deletions accessible/src/generic/HyperTextAccessible.cpp
Expand Up @@ -33,7 +33,7 @@
#include "nsTextFragment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/EventStates.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/MathAlgorithms.h"
#include "gfxSkipChars.h"
#include <algorithm>
Expand Down Expand Up @@ -1117,7 +1117,7 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
if (isFocusable)
TakeFocus();

Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
NS_ENSURE_STATE(domSel);

// Set up the selection.
Expand Down Expand Up @@ -1164,7 +1164,7 @@ HyperTextAccessible::CaretOffset() const

// Turn the focus node and offset of the selection into caret hypretext
// offset.
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
NS_ENSURE_TRUE(domSel, -1);

nsINode* focusNode = domSel->GetFocusNode();
Expand Down Expand Up @@ -1194,7 +1194,7 @@ HyperTextAccessible::CaretLineNumber()
if (!frameSelection)
return -1;

Selection* domSel =
dom::Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
if (!domSel)
return - 1;
Expand Down Expand Up @@ -1310,7 +1310,7 @@ HyperTextAccessible::GetSelectionDOMRanges(int16_t aType,
frameSelection->GetDisplaySelection() <= nsISelectionController::SELECTION_HIDDEN)
return;

Selection* domSel = frameSelection->GetSelection(aType);
dom::Selection* domSel = frameSelection->GetSelection(aType);
if (!domSel)
return;

Expand Down Expand Up @@ -1397,7 +1397,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
int32_t startOffset = ConvertMagicOffset(aStartOffset);
int32_t endOffset = ConvertMagicOffset(aEndOffset);

Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
if (!domSel)
return false;

Expand Down Expand Up @@ -1426,7 +1426,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
bool
HyperTextAccessible::RemoveFromSelection(int32_t aSelectionNum)
{
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
if (!domSel)
return false;

Expand Down Expand Up @@ -1508,11 +1508,45 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
void
HyperTextAccessible::EnclosingRange(a11y::TextRange& aRange) const
{
if (IsTextField()) {
aRange.Set(mDoc, const_cast<HyperTextAccessible*>(this), 0,
const_cast<HyperTextAccessible*>(this), ChildCount());
} else {
aRange.Set(mDoc, mDoc, 0, mDoc, mDoc->ChildCount());
}
}

void
HyperTextAccessible::SelectionRanges(nsTArray<a11y::TextRange>* aRanges) const
{
NS_ASSERTION(aRanges->Length() != 0, "TextRange array supposed to be empty");

dom::Selection* sel = DOMSelection();
if (!sel)
return;

aRanges->SetCapacity(sel->RangeCount());

for (uint32_t idx = 0; idx < sel->RangeCount(); idx++) {
nsRange* DOMRange = sel->GetRangeAt(idx);
HyperTextAccessible* startParent =
nsAccUtils::GetTextContainer(DOMRange->GetStartParent());
HyperTextAccessible* endParent =
nsAccUtils::GetTextContainer(DOMRange->GetEndParent());
if (!startParent || !endParent)
continue;

int32_t startOffset =
startParent->DOMPointToOffset(DOMRange->GetStartParent(),
DOMRange->StartOffset(), false);
int32_t endOffset =
endParent->DOMPointToOffset(DOMRange->GetEndParent(),
DOMRange->EndOffset(), true);

TextRange tr(IsTextField() ? const_cast<HyperTextAccessible*>(this) : mDoc,
startParent, startOffset, endParent, endOffset);
*(aRanges->AppendElement()) = Move(tr);
}
}

void
Expand All @@ -1524,12 +1558,16 @@ void
HyperTextAccessible::RangeByChild(Accessible* aChild,
a11y::TextRange& aRange) const
{
aRange.Set(mDoc, aChild, 0, aChild, aChild->ChildCount());
}

void
HyperTextAccessible::RangeAtPoint(int32_t aX, int32_t aY,
a11y::TextRange& aRange) const
{
Accessible* child = mDoc->ChildAtPoint(aX, aY, eDeepestChild);
if (child)
aRange.Set(mDoc, child, 0, child, child->ChildCount());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1810,7 +1848,7 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
if (!fs)
return NS_OK;

Selection* domSel = fs->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
dom::Selection* domSel = fs->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
if (!domSel)
return NS_OK;

Expand Down
2 changes: 1 addition & 1 deletion accessible/src/generic/HyperTextAccessible.h
Expand Up @@ -489,7 +489,7 @@ class HyperTextAccessible : public AccessibleWrap,
* Return frame/DOM selection object for the accessible.
*/
already_AddRefed<nsFrameSelection> FrameSelection() const;
Selection* DOMSelection() const;
dom::Selection* DOMSelection() const;

/**
* Return selection ranges within the accessible subtree.
Expand Down
9 changes: 8 additions & 1 deletion accessible/src/jsat/Constants.jsm
Expand Up @@ -3,7 +3,8 @@ const Cu = Components.utils;

Cu.import('resource://gre/modules/XPCOMUtils.jsm');

this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations', 'Filters', 'States'];
this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations',
'Filters', 'States', 'Prefilters'];

function ConstantsMap (aObject, aPrefix, aMap = {}, aModifier = null) {
let offset = aPrefix.length;
Expand Down Expand Up @@ -35,6 +36,12 @@ XPCOMUtils.defineLazyGetter(
return ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
});

XPCOMUtils.defineLazyGetter(
this, 'Prefilters',
function() {
return ConstantsMap(Ci.nsIAccessibleTraversalRule, 'PREFILTER_');
});

XPCOMUtils.defineLazyGetter(
this, 'Filters',
function() {
Expand Down

0 comments on commit 8bc8fda

Please sign in to comment.