1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set expandtab shiftwidth=2 tabstop=2: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef _mozilla_a11y_style_h_ 8 #define _mozilla_a11y_style_h_ 9 10 #include "mozilla/gfx/Types.h" 11 #include "nsStyleContext.h" 12 13 namespace mozilla { 14 namespace a11y { 15 16 class StyleInfo { 17 public: 18 explicit StyleInfo(dom::Element* aElement); ~StyleInfo()19 ~StyleInfo() {} 20 21 void Display(nsAString& aValue); 22 void TextAlign(nsAString& aValue); 23 void TextIndent(nsAString& aValue); MarginLeft(nsAString & aValue)24 void MarginLeft(nsAString& aValue) { Margin(eSideLeft, aValue); } MarginRight(nsAString & aValue)25 void MarginRight(nsAString& aValue) { Margin(eSideRight, aValue); } MarginTop(nsAString & aValue)26 void MarginTop(nsAString& aValue) { Margin(eSideTop, aValue); } MarginBottom(nsAString & aValue)27 void MarginBottom(nsAString& aValue) { Margin(eSideBottom, aValue); } 28 29 static void FormatColor(const nscolor& aValue, nsString& aFormattedValue); 30 static void FormatFontStyle(const nscoord& aValue, 31 nsAString& aFormattedValue); 32 static void FormatTextDecorationStyle(uint8_t aValue, 33 nsAString& aFormattedValue); 34 35 private: 36 StyleInfo() = delete; 37 StyleInfo(const StyleInfo&) = delete; 38 StyleInfo& operator=(const StyleInfo&) = delete; 39 40 void Margin(Side aSide, nsAString& aValue); 41 42 dom::Element* mElement; 43 RefPtr<nsStyleContext> mStyleContext; 44 }; 45 46 } // namespace a11y 47 } // namespace mozilla 48 49 #endif 50