accessible/src/base/nsAccessiblePivot.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef _nsAccessiblePivot_H_
michael@0 8 #define _nsAccessiblePivot_H_
michael@0 9
michael@0 10 #include "nsIAccessiblePivot.h"
michael@0 11
michael@0 12 #include "Accessible-inl.h"
michael@0 13 #include "nsAutoPtr.h"
michael@0 14 #include "nsTObserverArray.h"
michael@0 15 #include "nsCycleCollectionParticipant.h"
michael@0 16 #include "mozilla/Attributes.h"
michael@0 17
michael@0 18 class RuleCache;
michael@0 19
michael@0 20 /**
michael@0 21 * Class represents an accessible pivot.
michael@0 22 */
michael@0 23 class nsAccessiblePivot MOZ_FINAL : public nsIAccessiblePivot
michael@0 24 {
michael@0 25 public:
michael@0 26 typedef mozilla::a11y::Accessible Accessible;
michael@0 27
michael@0 28 nsAccessiblePivot(Accessible* aRoot);
michael@0 29
michael@0 30 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 31 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessiblePivot, nsIAccessiblePivot)
michael@0 32
michael@0 33 NS_DECL_NSIACCESSIBLEPIVOT
michael@0 34
michael@0 35 /*
michael@0 36 * A simple getter for the pivot's position.
michael@0 37 */
michael@0 38 Accessible* Position() { return mPosition; }
michael@0 39
michael@0 40 private:
michael@0 41 nsAccessiblePivot() MOZ_DELETE;
michael@0 42 nsAccessiblePivot(const nsAccessiblePivot&) MOZ_DELETE;
michael@0 43 void operator = (const nsAccessiblePivot&) MOZ_DELETE;
michael@0 44
michael@0 45 /*
michael@0 46 * Notify all observers on a pivot change. Return true if it has changed and
michael@0 47 * observers have been notified.
michael@0 48 */
michael@0 49 bool NotifyOfPivotChange(Accessible* aOldAccessible,
michael@0 50 int32_t aOldStart, int32_t aOldEnd,
michael@0 51 PivotMoveReason aReason);
michael@0 52
michael@0 53 /*
michael@0 54 * Check to see that the given accessible is a descendant of given ancestor
michael@0 55 */
michael@0 56 bool IsDescendantOf(Accessible* aAccessible, Accessible* aAncestor);
michael@0 57
michael@0 58
michael@0 59 /*
michael@0 60 * Search in preorder for the first accessible to match the rule.
michael@0 61 */
michael@0 62 Accessible* SearchForward(Accessible* aAccessible,
michael@0 63 nsIAccessibleTraversalRule* aRule,
michael@0 64 bool aSearchCurrent,
michael@0 65 nsresult* aResult);
michael@0 66
michael@0 67 /*
michael@0 68 * Reverse search in preorder for the first accessible to match the rule.
michael@0 69 */
michael@0 70 Accessible* SearchBackward(Accessible* aAccessible,
michael@0 71 nsIAccessibleTraversalRule* aRule,
michael@0 72 bool aSearchCurrent,
michael@0 73 nsresult* aResult);
michael@0 74
michael@0 75 /*
michael@0 76 * Search in preorder for the first text accessible.
michael@0 77 */
michael@0 78 mozilla::a11y::HyperTextAccessible* SearchForText(Accessible* aAccessible,
michael@0 79 bool aBackward);
michael@0 80
michael@0 81 /*
michael@0 82 * Get the effective root for this pivot, either the true root or modal root.
michael@0 83 */
michael@0 84 Accessible* GetActiveRoot() const
michael@0 85 {
michael@0 86 if (mModalRoot) {
michael@0 87 NS_ENSURE_FALSE(mModalRoot->IsDefunct(), mRoot);
michael@0 88 return mModalRoot;
michael@0 89 }
michael@0 90
michael@0 91 return mRoot;
michael@0 92 }
michael@0 93
michael@0 94 /*
michael@0 95 * Update the pivot, and notify observers. Return true if it moved.
michael@0 96 */
michael@0 97 bool MovePivotInternal(Accessible* aPosition, PivotMoveReason aReason);
michael@0 98
michael@0 99 /*
michael@0 100 * Get initial node we should start a search from with a given rule.
michael@0 101 *
michael@0 102 * When we do a move operation from one position to another,
michael@0 103 * the initial position can be inside of a subtree that is ignored by
michael@0 104 * the given rule. We need to step out of the ignored subtree and start
michael@0 105 * the search from there.
michael@0 106 *
michael@0 107 */
michael@0 108 Accessible* AdjustStartPosition(Accessible* aAccessible, RuleCache& aCache,
michael@0 109 uint16_t* aFilterResult, nsresult* aResult);
michael@0 110
michael@0 111 /*
michael@0 112 * The root accessible.
michael@0 113 */
michael@0 114 nsRefPtr<Accessible> mRoot;
michael@0 115
michael@0 116 /*
michael@0 117 * The temporary modal root accessible.
michael@0 118 */
michael@0 119 nsRefPtr<Accessible> mModalRoot;
michael@0 120
michael@0 121 /*
michael@0 122 * The current pivot position.
michael@0 123 */
michael@0 124 nsRefPtr<Accessible> mPosition;
michael@0 125
michael@0 126 /*
michael@0 127 * The text start offset ofthe pivot.
michael@0 128 */
michael@0 129 int32_t mStartOffset;
michael@0 130
michael@0 131 /*
michael@0 132 * The text end offset ofthe pivot.
michael@0 133 */
michael@0 134 int32_t mEndOffset;
michael@0 135
michael@0 136 /*
michael@0 137 * The list of pivot-changed observers.
michael@0 138 */
michael@0 139 nsTObserverArray<nsCOMPtr<nsIAccessiblePivotObserver> > mObservers;
michael@0 140 };
michael@0 141
michael@0 142 #endif

mercurial