accessible/src/base/Filters.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "Filters.h"
     7 #include "Accessible-inl.h"
     8 #include "nsAccUtils.h"
     9 #include "Role.h"
    10 #include "States.h"
    12 using namespace mozilla::a11y;
    13 using namespace mozilla::a11y::filters;
    15 uint32_t
    16 filters::GetSelected(Accessible* aAccessible)
    17 {
    18   if (aAccessible->State() & states::SELECTED)
    19     return eMatch | eSkipSubtree;
    21   return eSkip;
    22 }
    24 uint32_t
    25 filters::GetSelectable(Accessible* aAccessible)
    26 {
    27   if (aAccessible->InteractiveState() & states::SELECTABLE)
    28     return eMatch | eSkipSubtree;
    30   return eSkip;
    31 }
    33 uint32_t
    34 filters::GetRow(Accessible* aAccessible)
    35 {
    36   a11y::role role = aAccessible->Role();
    37   if (role == roles::ROW)
    38     return eMatch | eSkipSubtree;
    40   // Look for rows inside rowgroup.
    41   if (role == roles::GROUPING)
    42     return eSkip;
    44   return eSkipSubtree;
    45 }
    47 uint32_t
    48 filters::GetCell(Accessible* aAccessible)
    49 {
    50   a11y::role role = aAccessible->Role();
    51   return role == roles::GRID_CELL || role == roles::ROWHEADER ||
    52     role == roles::COLUMNHEADER ? eMatch : eSkipSubtree;
    53 }
    55 uint32_t
    56 filters::GetEmbeddedObject(Accessible* aAccessible)
    57 {
    58   return nsAccUtils::IsEmbeddedObject(aAccessible) ?
    59     eMatch | eSkipSubtree : eSkipSubtree;
    60 }

mercurial