2012-03-10 07:29:51 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
#ifndef nsTextAttrs_h_
|
|
|
|
#define nsTextAttrs_h_
|
|
|
|
|
2018-04-13 19:34:37 +00:00
|
|
|
#include "mozilla/FontPropertyTypes.h"
|
2012-08-01 18:31:10 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsColor.h"
|
2018-03-12 04:34:13 +00:00
|
|
|
#include "nsString.h"
|
2012-03-10 15:35:02 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2012-03-10 07:29:51 +00:00
|
|
|
|
2012-08-01 18:31:10 +00:00
|
|
|
class nsIFrame;
|
|
|
|
class nsIPersistentProperties;
|
|
|
|
class nsIContent;
|
|
|
|
class nsDeviceContext;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2012-11-18 02:01:44 +00:00
|
|
|
class Accessible;
|
|
|
|
class HyperTextAccessible;
|
|
|
|
|
2012-03-10 07:29:51 +00:00
|
|
|
/**
|
|
|
|
* Used to expose text attributes for the hyper text accessible (see
|
2012-05-31 08:04:41 +00:00
|
|
|
* HyperTextAccessible class).
|
2012-03-10 07:29:51 +00:00
|
|
|
*
|
|
|
|
* @note "invalid: spelling" text attribute is implemented entirely in
|
2012-05-31 08:04:41 +00:00
|
|
|
* HyperTextAccessible class.
|
2012-03-10 07:29:51 +00:00
|
|
|
*/
|
|
|
|
class TextAttrsMgr {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructor. Used to expose default text attributes.
|
|
|
|
*/
|
2014-09-02 16:19:58 +00:00
|
|
|
explicit TextAttrsMgr(HyperTextAccessible* aHyperTextAcc)
|
2012-07-30 14:20:58 +00:00
|
|
|
: mOffsetAcc(nullptr),
|
|
|
|
mHyperTextAcc(aHyperTextAcc),
|
2012-05-08 20:27:05 +00:00
|
|
|
mOffsetAccIdx(-1),
|
|
|
|
mIncludeDefAttrs(true) {}
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor. Used to expose text attributes at the given offset.
|
|
|
|
*
|
|
|
|
* @param aHyperTextAcc [in] hyper text accessible text attributes are
|
|
|
|
* calculated for
|
|
|
|
* @param aIncludeDefAttrs [optional] indicates whether default text
|
|
|
|
* attributes should be included into list of exposed
|
|
|
|
* text attributes
|
|
|
|
* @param oOffsetAcc [optional] offset an accessible the text attributes
|
|
|
|
* should be calculated for
|
|
|
|
* @param oOffsetAccIdx [optional] index in parent of offset accessible
|
|
|
|
*/
|
2012-05-31 08:04:41 +00:00
|
|
|
TextAttrsMgr(HyperTextAccessible* aHyperTextAcc, bool aIncludeDefAttrs,
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible* aOffsetAcc, int32_t aOffsetAccIdx)
|
2012-05-08 20:27:05 +00:00
|
|
|
: mOffsetAcc(aOffsetAcc),
|
|
|
|
mHyperTextAcc(aHyperTextAcc),
|
|
|
|
mOffsetAccIdx(aOffsetAccIdx),
|
|
|
|
mIncludeDefAttrs(aIncludeDefAttrs) {}
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return text attributes and hyper text offsets where these attributes are
|
|
|
|
* applied. Offsets are calculated in the case of non default attributes.
|
|
|
|
*
|
|
|
|
* @note In the case of default attributes pointers on hyper text offsets
|
|
|
|
* must be skipped.
|
|
|
|
*
|
|
|
|
* @param aAttributes [in, out] text attributes list
|
|
|
|
* @param aStartHTOffset [out, optional] start hyper text offset
|
|
|
|
* @param aEndHTOffset [out, optional] end hyper text offset
|
|
|
|
*/
|
|
|
|
void GetAttributes(nsIPersistentProperties* aAttributes,
|
2014-04-26 02:42:19 +00:00
|
|
|
uint32_t* aStartHTOffset = nullptr,
|
|
|
|
uint32_t* aEndHTOffset = nullptr);
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Calculates range (start and end offsets) of text where the text attributes
|
|
|
|
* are stretched. New offsets may be smaller if one of text attributes changes
|
|
|
|
* its value before or after the given offsets.
|
|
|
|
*
|
|
|
|
* @param aTextAttrArray [in] text attributes array
|
2012-03-12 03:37:30 +00:00
|
|
|
* @param aAttrArrayLen [in] text attributes array length
|
2012-03-10 07:29:51 +00:00
|
|
|
* @param aStartHTOffset [in, out] the start offset
|
|
|
|
* @param aEndHTOffset [in, out] the end offset
|
|
|
|
*/
|
|
|
|
class TextAttr;
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen,
|
2014-04-26 02:42:19 +00:00
|
|
|
uint32_t* aStartOffset, uint32_t* aEndOffset);
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible* mOffsetAcc;
|
2012-05-31 08:04:41 +00:00
|
|
|
HyperTextAccessible* mHyperTextAcc;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mOffsetAccIdx;
|
2012-05-08 20:27:05 +00:00
|
|
|
bool mIncludeDefAttrs;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Interface class of text attribute class implementations.
|
|
|
|
*/
|
|
|
|
class TextAttr {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Expose the text attribute to the given attribute set.
|
|
|
|
*
|
|
|
|
* @param aAttributes [in] the given attribute set
|
|
|
|
* @param aIncludeDefAttrValue [in] if true then attribute is exposed even
|
|
|
|
* if its value is the same as default one
|
|
|
|
*/
|
|
|
|
virtual void Expose(nsIPersistentProperties* aAttributes,
|
|
|
|
bool aIncludeDefAttrValue) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the text attribute value on the given element equals with
|
|
|
|
* predefined attribute value.
|
|
|
|
*/
|
2012-06-10 23:44:50 +00:00
|
|
|
virtual bool Equal(Accessible* aAccessible) = 0;
|
2012-03-10 07:29:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class to work with text attributes. See derived classes below.
|
|
|
|
*/
|
|
|
|
template <class T>
|
|
|
|
class TTextAttr : public TextAttr {
|
|
|
|
public:
|
2018-04-13 13:01:28 +00:00
|
|
|
explicit TTextAttr(bool aGetRootValue) : mGetRootValue(aGetRootValue) {}
|
2012-03-10 07:29:51 +00:00
|
|
|
|
2012-03-12 03:37:30 +00:00
|
|
|
// TextAttr
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void Expose(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aIncludeDefAttrValue) override {
|
2012-03-10 07:29:51 +00:00
|
|
|
if (mGetRootValue) {
|
|
|
|
if (mIsRootDefined) ExposeValue(aAttributes, mRootNativeValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mIsDefined) {
|
|
|
|
if (aIncludeDefAttrValue || mRootNativeValue != mNativeValue)
|
|
|
|
ExposeValue(aAttributes, mNativeValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aIncludeDefAttrValue && mIsRootDefined)
|
|
|
|
ExposeValue(aAttributes, mRootNativeValue);
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool Equal(Accessible* aAccessible) override {
|
2012-03-10 07:29:51 +00:00
|
|
|
T nativeValue;
|
2012-06-10 23:44:50 +00:00
|
|
|
bool isDefined = GetValueFor(aAccessible, &nativeValue);
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
if (!mIsDefined && !isDefined) return true;
|
|
|
|
|
|
|
|
if (mIsDefined && isDefined) return nativeValue == mNativeValue;
|
|
|
|
|
|
|
|
if (mIsDefined) return mNativeValue == mRootNativeValue;
|
|
|
|
|
|
|
|
return nativeValue == mRootNativeValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Expose the text attribute with the given value to attribute set.
|
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
|
|
|
const T& aValue) = 0;
|
|
|
|
|
|
|
|
// Return native value for the given DOM element.
|
2012-06-10 23:44:50 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible, T* aValue) = 0;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
// Indicates if root value should be exposed.
|
|
|
|
bool mGetRootValue;
|
|
|
|
|
|
|
|
// Native value and flag indicating if the value is defined (initialized in
|
|
|
|
// derived classes). Note, undefined native value means it is inherited
|
|
|
|
// from root.
|
2016-07-28 13:45:09 +00:00
|
|
|
MOZ_INIT_OUTSIDE_CTOR T mNativeValue;
|
|
|
|
MOZ_INIT_OUTSIDE_CTOR bool mIsDefined;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
// Native root value and flag indicating if the value is defined
|
|
|
|
// (initialized in derived classes).
|
2016-07-28 13:45:09 +00:00
|
|
|
MOZ_INIT_OUTSIDE_CTOR T mRootNativeValue;
|
|
|
|
MOZ_INIT_OUTSIDE_CTOR bool mIsRootDefined;
|
2012-03-10 07:29:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with 'language' text attribute.
|
|
|
|
*/
|
|
|
|
class LangTextAttr : public TTextAttr<nsString> {
|
|
|
|
public:
|
2012-05-31 08:04:41 +00:00
|
|
|
LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm,
|
2012-03-10 07:29:51 +00:00
|
|
|
nsIContent* aElm);
|
2012-08-01 18:31:10 +00:00
|
|
|
virtual ~LangTextAttr();
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// TextAttr
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
nsString* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsString& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIContent> mRootContent;
|
|
|
|
};
|
|
|
|
|
2013-02-09 04:36:34 +00:00
|
|
|
/**
|
|
|
|
* Class is used for the 'invalid' text attribute. Note, it calculated
|
|
|
|
* the attribute from aria-invalid attribute only; invalid:spelling attribute
|
|
|
|
* calculated from misspelled text in the editor is managed by
|
|
|
|
* HyperTextAccessible and applied on top of the value from aria-invalid.
|
|
|
|
*/
|
|
|
|
class InvalidTextAttr : public TTextAttr<uint32_t> {
|
|
|
|
public:
|
|
|
|
InvalidTextAttr(nsIContent* aRootElm, nsIContent* aElm);
|
|
|
|
virtual ~InvalidTextAttr(){};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum { eFalse, eGrammar, eSpelling, eTrue };
|
|
|
|
|
|
|
|
// TextAttr
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
uint32_t* aValue) override;
|
2013-02-09 04:36:34 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const uint32_t& aValue) override;
|
2013-02-09 04:36:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool GetValue(nsIContent* aElm, uint32_t* aValue);
|
|
|
|
nsIContent* mRootElm;
|
|
|
|
};
|
|
|
|
|
2012-03-10 07:29:51 +00:00
|
|
|
/**
|
|
|
|
* Class is used for the work with 'background-color' text attribute.
|
|
|
|
*/
|
|
|
|
class BGColorTextAttr : public TTextAttr<nscolor> {
|
|
|
|
public:
|
|
|
|
BGColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~BGColorTextAttr() {}
|
|
|
|
|
2013-02-09 04:36:34 +00:00
|
|
|
protected:
|
2012-03-10 07:29:51 +00:00
|
|
|
// TextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nscolor& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool GetColor(nsIFrame* aFrame, nscolor* aColor);
|
|
|
|
nsIFrame* mRootFrame;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with 'color' text attribute.
|
|
|
|
*/
|
|
|
|
class ColorTextAttr : public TTextAttr<nscolor> {
|
|
|
|
public:
|
|
|
|
ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~ColorTextAttr() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// TTextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nscolor& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with "font-family" text attribute.
|
|
|
|
*/
|
|
|
|
class FontFamilyTextAttr : public TTextAttr<nsString> {
|
|
|
|
public:
|
|
|
|
FontFamilyTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~FontFamilyTextAttr() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// TTextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
nsString* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsString& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool GetFontFamily(nsIFrame* aFrame, nsString& aFamily);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with "font-size" text attribute.
|
|
|
|
*/
|
|
|
|
class FontSizeTextAttr : public TTextAttr<nscoord> {
|
|
|
|
public:
|
|
|
|
FontSizeTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~FontSizeTextAttr() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// TTextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible, nscoord* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nscoord& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsDeviceContext* mDC;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with "font-style" text attribute.
|
|
|
|
*/
|
2018-04-23 14:52:20 +00:00
|
|
|
class FontStyleTextAttr : public TTextAttr<mozilla::FontSlantStyle> {
|
2012-03-10 07:29:51 +00:00
|
|
|
public:
|
|
|
|
FontStyleTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~FontStyleTextAttr() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// TTextAttr
|
2018-04-23 14:52:20 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aContent,
|
|
|
|
mozilla::FontSlantStyle* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2018-04-23 14:52:20 +00:00
|
|
|
const mozilla::FontSlantStyle& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class is used for the work with "font-weight" text attribute.
|
|
|
|
*/
|
2018-04-13 19:34:37 +00:00
|
|
|
class FontWeightTextAttr : public TTextAttr<mozilla::FontWeight> {
|
2012-03-10 07:29:51 +00:00
|
|
|
public:
|
|
|
|
FontWeightTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~FontWeightTextAttr() {}
|
|
|
|
|
2014-04-26 02:42:19 +00:00
|
|
|
protected:
|
2012-03-10 07:29:51 +00:00
|
|
|
// TTextAttr
|
2018-04-13 19:34:37 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
mozilla::FontWeight* aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2018-04-13 19:34:37 +00:00
|
|
|
const mozilla::FontWeight& aValue) override;
|
2012-03-10 07:29:51 +00:00
|
|
|
|
|
|
|
private:
|
2018-04-13 19:34:37 +00:00
|
|
|
mozilla::FontWeight GetFontWeight(nsIFrame* aFrame);
|
2012-03-10 07:29:51 +00:00
|
|
|
};
|
2012-03-10 15:35:02 +00:00
|
|
|
|
2012-06-10 23:44:50 +00:00
|
|
|
/**
|
|
|
|
* Class is used for the work with 'auto-generated' text attribute.
|
|
|
|
*/
|
|
|
|
class AutoGeneratedTextAttr : public TTextAttr<bool> {
|
|
|
|
public:
|
|
|
|
AutoGeneratedTextAttr(HyperTextAccessible* aHyperTextAcc,
|
|
|
|
Accessible* aAccessible);
|
|
|
|
virtual ~AutoGeneratedTextAttr() {}
|
|
|
|
|
|
|
|
protected:
|
2012-06-13 00:44:22 +00:00
|
|
|
// TextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible, bool* aValue) override;
|
2012-06-10 23:44:50 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const bool& aValue) override;
|
2012-06-10 23:44:50 +00:00
|
|
|
};
|
|
|
|
|
2012-03-10 15:35:02 +00:00
|
|
|
/**
|
|
|
|
* TextDecorTextAttr class is used for the work with
|
|
|
|
* "text-line-through-style", "text-line-through-color",
|
|
|
|
* "text-underline-style" and "text-underline-color" text attributes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class TextDecorValue {
|
|
|
|
public:
|
2017-10-31 11:09:01 +00:00
|
|
|
TextDecorValue()
|
|
|
|
: mColor{0},
|
2019-03-18 17:58:16 +00:00
|
|
|
mLine{StyleTextDecorationLine_NONE},
|
2017-10-31 11:09:01 +00:00
|
|
|
mStyle{NS_STYLE_TEXT_DECORATION_STYLE_NONE} {}
|
2014-09-02 16:19:58 +00:00
|
|
|
explicit TextDecorValue(nsIFrame* aFrame);
|
2012-03-10 15:35:02 +00:00
|
|
|
|
|
|
|
nscolor Color() const { return mColor; }
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t Style() const { return mStyle; }
|
2012-03-10 15:35:02 +00:00
|
|
|
|
|
|
|
bool IsDefined() const { return IsUnderline() || IsLineThrough(); }
|
|
|
|
bool IsUnderline() const {
|
2019-03-18 17:58:16 +00:00
|
|
|
return bool(mLine & mozilla::StyleTextDecorationLine_UNDERLINE);
|
2012-03-10 15:35:02 +00:00
|
|
|
}
|
|
|
|
bool IsLineThrough() const {
|
2019-03-18 17:58:16 +00:00
|
|
|
return bool(mLine & mozilla::StyleTextDecorationLine_LINE_THROUGH);
|
2012-03-10 15:35:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const TextDecorValue& aValue) {
|
|
|
|
return mColor == aValue.mColor && mLine == aValue.mLine &&
|
|
|
|
mStyle == aValue.mStyle;
|
|
|
|
}
|
|
|
|
bool operator!=(const TextDecorValue& aValue) { return !(*this == aValue); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
nscolor mColor;
|
2019-03-18 17:58:16 +00:00
|
|
|
mozilla::StyleTextDecorationLine mLine;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mStyle;
|
2012-03-10 15:35:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TextDecorTextAttr : public TTextAttr<TextDecorValue> {
|
|
|
|
public:
|
|
|
|
TextDecorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~TextDecorTextAttr() {}
|
|
|
|
|
2012-03-10 07:29:51 +00:00
|
|
|
protected:
|
2012-03-10 15:35:02 +00:00
|
|
|
// TextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
TextDecorValue* aValue) override;
|
2012-03-10 15:35:02 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const TextDecorValue& aValue) override;
|
2012-03-10 15:35:02 +00:00
|
|
|
};
|
|
|
|
|
2012-03-12 12:03:43 +00:00
|
|
|
/**
|
|
|
|
* Class is used for the work with "text-position" text attribute.
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum TextPosValue {
|
|
|
|
eTextPosNone = 0,
|
|
|
|
eTextPosBaseline,
|
|
|
|
eTextPosSub,
|
|
|
|
eTextPosSuper
|
|
|
|
};
|
|
|
|
|
|
|
|
class TextPosTextAttr : public TTextAttr<TextPosValue> {
|
|
|
|
public:
|
|
|
|
TextPosTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
|
|
|
virtual ~TextPosTextAttr() {}
|
|
|
|
|
2012-03-10 15:35:02 +00:00
|
|
|
protected:
|
2012-03-12 12:03:43 +00:00
|
|
|
// TextAttr
|
2015-01-15 20:39:04 +00:00
|
|
|
virtual bool GetValueFor(Accessible* aAccessible,
|
|
|
|
TextPosValue* aValue) override;
|
2012-03-12 12:03:43 +00:00
|
|
|
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
|
2015-03-21 16:28:04 +00:00
|
|
|
const TextPosValue& aValue) override;
|
2012-03-12 12:03:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
TextPosValue GetTextPosValue(nsIFrame* aFrame) const;
|
|
|
|
};
|
|
|
|
|
2012-03-10 07:29:51 +00:00
|
|
|
}; // TextAttrMgr
|
|
|
|
|
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|