TextSizeAdjustment.h [plain text]
#ifndef TextSizeAdjustment_h
#define TextSizeAdjustment_h
#if ENABLE(IOS_TEXT_AUTOSIZING)
enum TextSizeAdjustmentType { AutoTextSizeAdjustment = -1, NoTextSizeAdjustment = -2 };
class TextSizeAdjustment {
public:
TextSizeAdjustment() : m_value(AutoTextSizeAdjustment) { }
TextSizeAdjustment(float value) : m_value(value) { }
float percentage() const { return m_value; }
float multiplier() const { return m_value / 100; }
bool isAuto() const { return m_value == AutoTextSizeAdjustment; }
bool isNone() const { return m_value == NoTextSizeAdjustment; }
bool isPercentage() const { return m_value >= 0; }
bool operator==(const TextSizeAdjustment& anAdjustment) const { return m_value == anAdjustment.m_value; }
bool operator!=(const TextSizeAdjustment& anAdjustment) const { return m_value != anAdjustment.m_value; }
private:
float m_value;
};
#endif // ENABLE(IOS_TEXT_AUTOSIZING)
#endif // TextSizeAdjustment_h