LCOV - code coverage report
Current view: top level - accessible/generic - ImageAccessible.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef mozilla_a11y_ImageAccessible_h__
       7             : #define mozilla_a11y_ImageAccessible_h__
       8             : 
       9             : #include "BaseAccessibles.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace a11y {
      13             : 
      14             : /* Accessible for supporting images
      15             :  * supports:
      16             :  * - gets name, role
      17             :  * - support basic state
      18             :  */
      19             : class ImageAccessible : public LinkableAccessible
      20             : {
      21             : public:
      22             :   ImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
      23             : 
      24             :   // Accessible
      25             :   virtual a11y::role NativeRole() override;
      26             :   virtual uint64_t NativeState() override;
      27             :   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
      28             : 
      29             :   // ActionAccessible
      30             :   virtual uint8_t ActionCount() override;
      31             :   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
      32             :   virtual bool DoAction(uint8_t aIndex) override;
      33             : 
      34             :   // ImageAccessible
      35             :   nsIntPoint Position(uint32_t aCoordType);
      36             :   nsIntSize Size();
      37             : 
      38             : protected:
      39             :   virtual ~ImageAccessible();
      40             : 
      41             :   // Accessible
      42             :   virtual ENameValueFlag NativeName(nsString& aName) override;
      43             : 
      44             : private:
      45             :   /**
      46             :    * Return whether the element has a longdesc URI.
      47             :    */
      48           0 :   bool HasLongDesc() const
      49             :   {
      50           0 :     nsCOMPtr<nsIURI> uri = GetLongDescURI();
      51           0 :     return uri;
      52             :   }
      53             : 
      54             :   /**
      55             :    * Return an URI for showlongdesc action if any.
      56             :    */
      57             :   already_AddRefed<nsIURI> GetLongDescURI() const;
      58             : 
      59             :   /**
      60             :    * Used by ActionNameAt and DoAction to ensure the index for opening the
      61             :    * longdesc URL is valid.
      62             :    * It is always assumed that the highest possible index opens the longdesc.
      63             :    * This doesn't check that there is actually a longdesc, just that the index
      64             :    * would be correct if there was one.
      65             :    *
      66             :    * @param aIndex  The 0-based index to be tested.
      67             :    *
      68             :    * @returns  true if index is valid for longdesc action.
      69             :    */
      70             :   inline bool IsLongDescIndex(uint8_t aIndex);
      71             : 
      72             : };
      73             : 
      74             : ////////////////////////////////////////////////////////////////////////////////
      75             : // Accessible downcasting method
      76             : 
      77             : inline ImageAccessible*
      78           0 : Accessible::AsImage()
      79             : {
      80           0 :   return IsImage() ? static_cast<ImageAccessible*>(this) : nullptr;
      81             : }
      82             : 
      83             : } // namespace a11y
      84             : } // namespace mozilla
      85             : 
      86             : #endif
      87             : 

Generated by: LCOV version 1.13