accessible/src/generic/TextLeafAccessible.h

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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef mozilla_a11y_TextLeafAccessible_h__
     7 #define mozilla_a11y_TextLeafAccessible_h__
     9 #include "BaseAccessibles.h"
    11 namespace mozilla {
    12 namespace a11y {
    14 /**
    15  * Generic class used for text nodes.
    16  */
    17 class TextLeafAccessible : public LinkableAccessible
    18 {
    19 public:
    20   TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
    21   virtual ~TextLeafAccessible();
    23   // Accessible
    24   virtual mozilla::a11y::role NativeRole();
    25   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
    26                             uint32_t aLength = UINT32_MAX);
    27   virtual ENameValueFlag Name(nsString& aName);
    29   // TextLeafAccessible
    30   void SetText(const nsAString& aText) { mText = aText; }
    31   const nsString& Text() const { return mText; }
    33 protected:
    34   // Accessible
    35   virtual void CacheChildren();
    37 protected:
    38   nsString mText;
    39 };
    42 ////////////////////////////////////////////////////////////////////////////////
    43 // Accessible downcast method
    45 inline TextLeafAccessible*
    46 Accessible::AsTextLeaf()
    47 {
    48   return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr;
    49 }
    51 } // namespace a11y
    52 } // namespace mozilla
    54 #endif

mercurial