DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (dcc6d7a0dc00)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_a11y_DocAccessibleChild_h
#define mozilla_a11y_DocAccessibleChild_h

#include "mozilla/a11y/DocAccessible.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "nsISupportsImpl.h"

namespace mozilla {
namespace a11y {
class Accessible;
class HyperTextAccessible;
class TextLeafAccessible;
class ImageAccessible;
class TableAccessible;
class TableCellAccessible;
class AccShowEvent;

  /*
   * These objects handle content side communication for an accessible document,
   * and their lifetime is the same as the document they represent.
   */
class DocAccessibleChild : public PDocAccessibleChild
{
public:
  explicit DocAccessibleChild(DocAccessible* aDoc) :
    mDoc(aDoc)
  { MOZ_COUNT_CTOR(DocAccessibleChild); }
  ~DocAccessibleChild()
  {
    // Shutdown() should have been called, but maybe it isn't if the process is
    // killed?
    MOZ_ASSERT(!mDoc);
    if (mDoc)
      mDoc->SetIPCDoc(nullptr);
    MOZ_COUNT_DTOR(DocAccessibleChild);
  }

  void Shutdown()
  {
    mDoc->SetIPCDoc(nullptr);
    mDoc = nullptr;
    SendShutdown();
  }

  virtual void ActorDestroy(ActorDestroyReason) override
  {
    if (!mDoc)
      return;

    mDoc->SetIPCDoc(nullptr);
    mDoc = nullptr;
  }

  void ShowEvent(AccShowEvent* aShowEvent);

  /*
   * Return the state for the accessible with given ID.
   */
  virtual bool RecvState(const uint64_t& aID, uint64_t* aState) override;

  /*
   * Return the native state for the accessible with given ID.
   */
  virtual bool RecvNativeState(const uint64_t& aID, uint64_t* aState) override;

  /*
   * Get the name for the accessible with given id.
   */
  virtual bool RecvName(const uint64_t& aID, nsString* aName) override;

  virtual bool RecvValue(const uint64_t& aID, nsString* aValue) override;

  virtual bool RecvHelp(const uint64_t& aID, nsString* aHelp) override;

  /*
   * Get the description for the accessible with given id.
   */
  virtual bool RecvDescription(const uint64_t& aID, nsString* aDesc) override;
  virtual bool RecvRelationByType(const uint64_t& aID, const uint32_t& aType,
                                  nsTArray<uint64_t>* aTargets) override;
  virtual bool RecvRelations(const uint64_t& aID,
                             nsTArray<RelationTargets>* aRelations)
    override;

  virtual bool RecvIsSearchbox(const uint64_t& aID, bool* aRetVal) override;

  virtual bool RecvLandmarkRole(const uint64_t& aID, nsString* aLandmark) override;

  virtual bool RecvARIARoleAtom(const uint64_t& aID, nsString* aRole) override;

  virtual bool RecvGetLevelInternal(const uint64_t& aID, int32_t* aLevel) override;

  virtual bool RecvAttributes(const uint64_t& aID,
                              nsTArray<Attribute> *aAttributes) override;
  virtual bool RecvScrollTo(const uint64_t& aID, const uint32_t& aScrollType)
    override;
  virtual bool RecvScrollToPoint(const uint64_t& aID,
                                 const uint32_t& aScrollType,
                                 const int32_t& aX, const int32_t& aY) override;

  virtual bool RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
    override;
  virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
    override;
  virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset)
    override;

  virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
     override;
  virtual bool RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
     override;

  virtual bool RecvTextSubstring(const uint64_t& aID,
                                 const int32_t& aStartOffset,
                                 const int32_t& aEndOffset, nsString* aText,
                                 bool* aValid) override;

  virtual bool RecvGetTextAfterOffset(const uint64_t& aID,
                                      const int32_t& aOffset,
                                      const int32_t& aBoundaryType,
                                      nsString* aText, int32_t* aStartOffset,
                                      int32_t* aEndOffset) override;
  virtual bool RecvGetTextAtOffset(const uint64_t& aID,
                                   const int32_t& aOffset,
                                   const int32_t& aBoundaryType,
                                   nsString* aText, int32_t* aStartOffset,
                                   int32_t* aEndOffset) override;
  virtual bool RecvGetTextBeforeOffset(const uint64_t& aID,
                                       const int32_t& aOffset,
                                       const int32_t& aBoundaryType,
                                       nsString* aText, int32_t* aStartOffset,
                                       int32_t* aEndOffset) override;

  virtual bool RecvCharAt(const uint64_t& aID,
                          const int32_t& aOffset,
                          uint16_t* aChar) override;

  virtual bool RecvTextAttributes(const uint64_t& aID,
                                  const bool& aIncludeDefAttrs,
                                  const int32_t& aOffset,
                                  nsTArray<Attribute>* aAttributes,
                                  int32_t* aStartOffset,
                                  int32_t* aEndOffset)
    override;

  virtual bool RecvDefaultTextAttributes(const uint64_t& aID,
                                         nsTArray<Attribute>* aAttributes)
    override;

  virtual bool RecvTextBounds(const uint64_t& aID,
                              const int32_t& aStartOffset,
                              const int32_t& aEndOffset,
                              const uint32_t& aCoordType,
                              nsIntRect* aRetVal) override;

  virtual bool RecvCharBounds(const uint64_t& aID,
                              const int32_t& aOffset,
                              const uint32_t& aCoordType,
                              nsIntRect* aRetVal) override;

  virtual bool RecvOffsetAtPoint(const uint64_t& aID,
                                 const int32_t& aX,
                                 const int32_t& aY,
                                 const uint32_t& aCoordType,
                                 int32_t* aRetVal) override;

  virtual bool RecvSelectionBoundsAt(const uint64_t& aID,
                                     const int32_t& aSelectionNum,
                                     bool* aSucceeded,
                                     nsString* aData,
                                     int32_t* aStartOffset,
                                     int32_t* aEndOffset) override;

  virtual bool RecvSetSelectionBoundsAt(const uint64_t& aID,
                                        const int32_t& aSelectionNum,
                                        const int32_t& aStartOffset,
                                        const int32_t& aEndOffset,
                                        bool* aSucceeded) override;

  virtual bool RecvAddToSelection(const uint64_t& aID,
                                  const int32_t& aStartOffset,
                                  const int32_t& aEndOffset,
                                  bool* aSucceeded) override;

  virtual bool RecvRemoveFromSelection(const uint64_t& aID,
                                       const int32_t& aSelectionNum,
                                       bool* aSucceeded) override;

  virtual bool RecvScrollSubstringTo(const uint64_t& aID,
                                     const int32_t& aStartOffset,
                                     const int32_t& aEndOffset,
                                     const uint32_t& aScrollType) override;

  virtual bool RecvScrollSubstringToPoint(const uint64_t& aID,
                                          const int32_t& aStartOffset,
                                          const int32_t& aEndOffset,
                                          const uint32_t& aCoordinateType,
                                          const int32_t& aX,
                                          const int32_t& aY) override;

  virtual bool RecvText(const uint64_t& aID,
                        nsString* aText) override;

  virtual bool RecvReplaceText(const uint64_t& aID,
                               const nsString& aText) override;

  virtual bool RecvInsertText(const uint64_t& aID,
                              const nsString& aText,
                              const int32_t& aPosition, bool* aValid) override;

  virtual bool RecvCopyText(const uint64_t& aID,
                            const int32_t& aStartPos,
                            const int32_t& aEndPos, bool* aValid) override;

  virtual bool RecvCutText(const uint64_t& aID,
                           const int32_t& aStartPos,
                           const int32_t& aEndPos, bool* aValid) override;

  virtual bool RecvDeleteText(const uint64_t& aID,
                              const int32_t& aStartPos,
                              const int32_t& aEndPos, bool* aValid) override;

  virtual bool RecvPasteText(const uint64_t& aID,
                             const int32_t& aPosition, bool* aValid) override;

  virtual bool RecvImagePosition(const uint64_t& aID,
                                 const uint32_t& aCoordType,
                                 nsIntPoint* aRetVal) override;

  virtual bool RecvImageSize(const uint64_t& aID,
                             nsIntSize* aRetVal) override;

  virtual bool RecvStartOffset(const uint64_t& aID,
                               uint32_t* aRetVal,
                               bool* aOk) override;
  virtual bool RecvEndOffset(const uint64_t& aID,
                             uint32_t* aRetVal,
                             bool* aOk) override;
  virtual bool RecvIsLinkValid(const uint64_t& aID,
                               bool* aRetVal) override;
  virtual bool RecvAnchorCount(const uint64_t& aID,
                               uint32_t* aRetVal, bool* aOk) override;
  virtual bool RecvAnchorURIAt(const uint64_t& aID,
                               const uint32_t& aIndex,
                               nsCString* aURI,
                               bool* aOk) override;
  virtual bool RecvAnchorAt(const uint64_t& aID,
                            const uint32_t& aIndex,
                            uint64_t* aIDOfAnchor,
                            bool* aOk) override;

  virtual bool RecvLinkCount(const uint64_t& aID,
                             uint32_t* aCount) override;

  virtual bool RecvLinkAt(const uint64_t& aID,
                          const uint32_t& aIndex,
                          uint64_t* aIDOfLink,
                          bool* aOk) override;

  virtual bool RecvLinkIndexOf(const uint64_t& aID,
                               const uint64_t& aLinkID,
                               int32_t* aIndex) override;

  virtual bool RecvLinkIndexAtOffset(const uint64_t& aID,
                                     const uint32_t& aOffset,
                                     int32_t* aIndex) override;

  virtual bool RecvTableOfACell(const uint64_t& aID,
                                uint64_t* aTableID,
                                bool* aOk) override;

  virtual bool RecvColIdx(const uint64_t& aID, uint32_t* aIndex) override;

  virtual bool RecvRowIdx(const uint64_t& aID, uint32_t* aIndex) override;

  virtual bool RecvColExtent(const uint64_t& aID, uint32_t* aExtent) override;

  virtual bool RecvRowExtent(const uint64_t& aID, uint32_t* aExtent) override;

  virtual bool RecvColHeaderCells(const uint64_t& aID,
                                  nsTArray<uint64_t>* aCells) override;

  virtual bool RecvRowHeaderCells(const uint64_t& aID,
                                  nsTArray<uint64_t>* aCells) override;

  virtual bool RecvIsCellSelected(const uint64_t& aID,
                                  bool* aSelected) override;

  virtual bool RecvTableCaption(const uint64_t& aID,
                                uint64_t* aCaptionID,
                                bool* aOk) override;
  virtual bool RecvTableSummary(const uint64_t& aID,
                                nsString* aSummary) override;
  virtual bool RecvTableColumnCount(const uint64_t& aID,
                                    uint32_t* aColCount) override;
  virtual bool RecvTableRowCount(const uint64_t& aID,
                                 uint32_t* aRowCount) override;
  virtual bool RecvTableCellAt(const uint64_t& aID,
                               const uint32_t& aRow,
                               const uint32_t& aCol,
                               uint64_t* aCellID,
                               bool* aOk) override;
  virtual bool RecvTableCellIndexAt(const uint64_t& aID,
                                    const uint32_t& aRow,
                                    const uint32_t& aCol,
                                    int32_t* aIndex) override;
  virtual bool RecvTableColumnIndexAt(const uint64_t& aID,
                                      const uint32_t& aCellIndex,
                                      int32_t* aCol) override;
  virtual bool RecvTableRowIndexAt(const uint64_t& aID,
                                   const uint32_t& aCellIndex,
                                   int32_t* aRow) override;
  virtual bool RecvTableRowAndColumnIndicesAt(const uint64_t& aID,
                                             const uint32_t& aCellIndex,
                                             int32_t* aRow,
                                             int32_t* aCol) override;
  virtual bool RecvTableColumnExtentAt(const uint64_t& aID,
                                       const uint32_t& aRow,
                                       const uint32_t& aCol,
                                       uint32_t* aExtent) override;
  virtual bool RecvTableRowExtentAt(const uint64_t& aID,
                                    const uint32_t& aRow,
                                    const uint32_t& aCol,
                                    uint32_t* aExtent) override;
  virtual bool RecvTableColumnDescription(const uint64_t& aID,
                                          const uint32_t& aCol,
                                          nsString* aDescription) override;
  virtual bool RecvTableRowDescription(const uint64_t& aID,
                                       const uint32_t& aRow,
                                       nsString* aDescription) override;
  virtual bool RecvTableColumnSelected(const uint64_t& aID,
                                       const uint32_t& aCol,
                                       bool* aSelected) override;
  virtual bool RecvTableRowSelected(const uint64_t& aID,
                                    const uint32_t& aRow,
                                    bool* aSelected) override;
  virtual bool RecvTableCellSelected(const uint64_t& aID,
                                     const uint32_t& aRow,
                                     const uint32_t& aCol,
                                     bool* aSelected) override;
  virtual bool RecvTableSelectedCellCount(const uint64_t& aID,
                                          uint32_t* aSelectedCells) override;
  virtual bool RecvTableSelectedColumnCount(const uint64_t& aID,
                                            uint32_t* aSelectedColumns) override;
  virtual bool RecvTableSelectedRowCount(const uint64_t& aID,
                                         uint32_t* aSelectedRows) override;
  virtual bool RecvTableSelectedCells(const uint64_t& aID,
                                      nsTArray<uint64_t>* aCellIDs) override;
  virtual bool RecvTableSelectedCellIndices(const uint64_t& aID,
                                            nsTArray<uint32_t>* aCellIndices) override;
  virtual bool RecvTableSelectedColumnIndices(const uint64_t& aID,
                                              nsTArray<uint32_t>* aColumnIndices) override;
  virtual bool RecvTableSelectedRowIndices(const uint64_t& aID,
                                           nsTArray<uint32_t>* aRowIndices) override;
  virtual bool RecvTableSelectColumn(const uint64_t& aID,
                                     const uint32_t& aCol) override;
  virtual bool RecvTableSelectRow(const uint64_t& aID,
                                  const uint32_t& aRow) override;
  virtual bool RecvTableUnselectColumn(const uint64_t& aID,
                                       const uint32_t& aCol) override;
  virtual bool RecvTableUnselectRow(const uint64_t& aID,
                                    const uint32_t& aRow) override;
  virtual bool RecvTableIsProbablyForLayout(const uint64_t& aID,
                                            bool* aForLayout) override;
  virtual bool RecvAtkTableColumnHeader(const uint64_t& aID,
                                        const int32_t& aCol,
                                        uint64_t* aHeader,
                                        bool* aOk) override;
  virtual bool RecvAtkTableRowHeader(const uint64_t& aID,
                                     const int32_t& aRow,
                                     uint64_t* aHeader,
                                     bool* aOk) override;

  virtual bool RecvSelectedItems(const uint64_t& aID,
                                 nsTArray<uint64_t>* aSelectedItemIDs) override;

  virtual bool RecvSelectedItemCount(const uint64_t& aID,
                                     uint32_t* aCount) override;

  virtual bool RecvGetSelectedItem(const uint64_t& aID,
                                   const uint32_t& aIndex,
                                   uint64_t* aSelected,
                                   bool* aOk) override;

  virtual bool RecvIsItemSelected(const uint64_t& aID,
                                  const uint32_t& aIndex,
                                  bool* aSelected) override;

  virtual bool RecvAddItemToSelection(const uint64_t& aID,
                                      const uint32_t& aIndex,
                                      bool* aSuccess) override;

  virtual bool RecvRemoveItemFromSelection(const uint64_t& aID,
                                           const uint32_t& aIndex,
                                           bool* aSuccess) override;

  virtual bool RecvSelectAll(const uint64_t& aID,
                             bool* aSuccess) override;

  virtual bool RecvUnselectAll(const uint64_t& aID,
                               bool* aSuccess) override;

  virtual bool RecvTakeSelection(const uint64_t& aID) override;
  virtual bool RecvSetSelected(const uint64_t& aID,
                               const bool& aSelect) override;

  virtual bool RecvDoAction(const uint64_t& aID,
                            const uint8_t& aIndex,
                            bool* aSuccess) override;

  virtual bool RecvActionCount(const uint64_t& aID,
                               uint8_t* aCount) override;

  virtual bool RecvActionDescriptionAt(const uint64_t& aID,
                                       const uint8_t& aIndex,
                                       nsString* aDescription) override;

  virtual bool RecvActionNameAt(const uint64_t& aID,
                                const uint8_t& aIndex,
                                nsString* aName) override;

  virtual bool RecvAccessKey(const uint64_t& aID,
                             uint32_t* aKey,
                             uint32_t* aModifierMask) override;

  virtual bool RecvKeyboardShortcut(const uint64_t& aID,
                                    uint32_t* aKey,
                                    uint32_t* aModifierMask) override;

  virtual bool RecvAtkKeyBinding(const uint64_t& aID,
                                 nsString* aResult) override;

  virtual bool RecvCurValue(const uint64_t& aID,
                            double* aValue) override;

  virtual bool RecvSetCurValue(const uint64_t& aID,
                               const double& aValue,
                               bool* aRetVal) override;

  virtual bool RecvMinValue(const uint64_t& aID,
                            double* aValue) override;

  virtual bool RecvMaxValue(const uint64_t& aID,
                            double* aValue) override;

  virtual bool RecvStep(const uint64_t& aID,
                        double* aStep) override;

  virtual bool RecvTakeFocus(const uint64_t& aID) override;

  virtual bool RecvEmbeddedChildCount(const uint64_t& aID, uint32_t* aCount)
    override final;

  virtual bool RecvIndexOfEmbeddedChild(const uint64_t& aID,
                                        const uint64_t& aChildID,
                                        uint32_t* aChildIdx) override final;

  virtual bool RecvEmbeddedChildAt(const uint64_t& aID, const uint32_t& aIdx,
                                   uint64_t* aChildID) override final;

  virtual bool RecvFocusedChild(const uint64_t& aID,
                                uint64_t* aChild,
                                bool* aOk) override;

  virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
  virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
  virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
  virtual bool RecvURL(const uint64_t& aID, nsString* aURL) override;
  virtual bool RecvMimeType(const uint64_t& aID, nsString* aMime) override;
  virtual bool RecvURLDocTypeMimeType(const uint64_t& aID,
                                      nsString* aURL,
                                      nsString* aDocType,
                                      nsString* aMimeType) override;

  virtual bool RecvAccessibleAtPoint(const uint64_t& aID,
                                     const int32_t& aX,
                                     const int32_t& aY,
                                     const bool& aNeedsScreenCoords,
                                     const uint32_t& aWhich,
                                     uint64_t* aResult,
                                     bool* aOk) override;

  virtual bool RecvExtents(const uint64_t& aID,
                           const bool& aNeedsScreenCoords,
                           int32_t* aX,
                           int32_t* aY,
                           int32_t* aWidth,
                           int32_t* aHeight) override;
private:

  Accessible* IdToAccessible(const uint64_t& aID) const;
  Accessible* IdToAccessibleLink(const uint64_t& aID) const;
  Accessible* IdToAccessibleSelect(const uint64_t& aID) const;
  HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const;
  TextLeafAccessible* IdToTextLeafAccessible(const uint64_t& aID) const;
  ImageAccessible* IdToImageAccessible(const uint64_t& aID) const;
  TableCellAccessible* IdToTableCellAccessible(const uint64_t& aID) const;
  TableAccessible* IdToTableAccessible(const uint64_t& aID) const;

  bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
                                   nsTArray<Attribute>* aAttributes);

  DocAccessible* mDoc;
};

}
}

#endif