⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 css_valueimpl.h

📁 手机浏览器源码程序,功能强大
💻 H
📖 第 1 页 / 共 2 页
字号:
protected:
    CSSPrimitiveValueImpl *m_top;
    CSSPrimitiveValueImpl *m_right;
    CSSPrimitiveValueImpl *m_bottom;
    CSSPrimitiveValueImpl *m_left;
};

#if APPLE_CHANGES

class DashboardRegionImpl : public RectImpl {
public:
    DashboardRegionImpl() : m_next(0), m_isCircle(0), m_isRectangle(0) { }
    ~DashboardRegionImpl() {
        if (m_next)
            m_next->deref();
    }

    void setNext (DashboardRegionImpl *next)
    {
        if (next) next->ref();
        if (m_next) m_next->deref();
        m_next = next;
    }
    
public:
    DashboardRegionImpl *m_next;
    QString m_label;
    QString m_geometryType;
    unsigned int m_isCircle:1;
    unsigned int m_isRectangle:1;
};

#endif

class CSSImageValueImpl : public CSSPrimitiveValueImpl, public khtml::CachedObjectClient
{
public:
    CSSImageValueImpl();
    CSSImageValueImpl(const DOMString &url, StyleBaseImpl *style);
    virtual ~CSSImageValueImpl();

    khtml::CachedImage *image(khtml::DocLoader* loader);

protected:
    khtml::CachedImage* m_image;
    bool m_accessedImage;
};

class FontFamilyValueImpl : public CSSPrimitiveValueImpl
{
public:
    FontFamilyValueImpl( const QString &string);
    const QString &fontName() const { return parsedFontName; }
    int genericFamilyType() const { return _genericFamilyType; }

    virtual DOMString cssText() const;

    QString parsedFontName;
private:
    int _genericFamilyType;
};

class FontValueImpl : public CSSValueImpl
{
public:
    FontValueImpl();
    virtual ~FontValueImpl();

    virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
    
    virtual DOMString cssText() const;
    
    virtual bool isFontValue() { return true; }

    CSSPrimitiveValueImpl *style;
    CSSPrimitiveValueImpl *variant;
    CSSPrimitiveValueImpl *weight;
    CSSPrimitiveValueImpl *size;
    CSSPrimitiveValueImpl *lineHeight;
    CSSValueListImpl *family;
};

// Used for text-shadow and box-shadow
class ShadowValueImpl : public CSSValueImpl
{
public:
    ShadowValueImpl(CSSPrimitiveValueImpl* _x, CSSPrimitiveValueImpl* _y,
                    CSSPrimitiveValueImpl* _blur, CSSPrimitiveValueImpl* _color);
    virtual ~ShadowValueImpl();

    virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }

    virtual DOMString cssText() const;

    CSSPrimitiveValueImpl* x;
    CSSPrimitiveValueImpl* y;
    CSSPrimitiveValueImpl* blur;
    CSSPrimitiveValueImpl* color;
};

// Used by box-flex-group-transition
class FlexGroupTransitionValueImpl : public CSSValueImpl
{
public:
    FlexGroupTransitionValueImpl();
    FlexGroupTransitionValueImpl(unsigned int _group1, 
                                 unsigned int _group2,
                                 CSSPrimitiveValueImpl* _length);
    virtual ~FlexGroupTransitionValueImpl();
    
    virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
    
    virtual DOMString cssText() const;
    
    bool isAuto() const { return autoValue; }

    bool autoValue;
    unsigned int group1;
    unsigned int group2;
    CSSPrimitiveValueImpl* length;
};

// ------------------------------------------------------------------------------

// another helper class
class CSSProperty
OOM_MODIFIED
{
public:
    CSSProperty() : m_id(-1), m_bImportant(false), m_value(0)
    {
    }
    CSSProperty(int propID, CSSValueImpl *value, bool important = false)
        : m_id(propID), m_bImportant(important), m_value(value)
    {
        if (value) value->ref();
    }
    CSSProperty(const CSSProperty& o)
    {
        m_id = o.m_id;
        m_bImportant = o.m_bImportant;
        m_value = o.m_value;
        if (m_value) m_value->ref();
    }
    CSSProperty &operator=(const CSSProperty& o)
    {
        if (o.m_value) o.m_value->ref();
	if (m_value) m_value->deref();
        m_id = o.m_id;
        m_bImportant = o.m_bImportant;
        m_value = o.m_value;
        return *this;
    }
    ~CSSProperty() {
	if(m_value) m_value->deref();
    }

    void setValue(CSSValueImpl *val) {
	if (val) val->ref();
        if (m_value) m_value->deref();
        m_value = val;
    }

    int id() const { return m_id; }
    bool isImportant() const { return m_bImportant; }
    CSSValueImpl *value() const { return m_value; }
    
    DOMString cssText() const;

    // make sure the following fits in 4 bytes.
    int  m_id;
    bool m_bImportant;

    friend bool operator==(const CSSProperty &, const CSSProperty &);

protected:
    CSSValueImpl *m_value;
};

class CSSMutableStyleDeclarationImpl : public CSSStyleDeclarationImpl
{
public:
    CSSMutableStyleDeclarationImpl();
    CSSMutableStyleDeclarationImpl(CSSRuleImpl *parentRule);
    CSSMutableStyleDeclarationImpl(CSSRuleImpl *parentRule, const QValueList<CSSProperty> &);
    CSSMutableStyleDeclarationImpl(CSSRuleImpl *parentRule, const CSSProperty * const *, int numProperties);
    virtual ~CSSMutableStyleDeclarationImpl();

    CSSMutableStyleDeclarationImpl &operator=(const CSSMutableStyleDeclarationImpl &);

    void setNode(NodeImpl *node) { m_node = node; }

    virtual DOMString cssText() const;
    virtual void setCssText(const DOMString &, int &exceptionCode);

    virtual unsigned long length() const;
    virtual DOMString item(unsigned long index) const;

    virtual CSSValueImpl *getPropertyCSSValue(int propertyID) const;
    virtual DOMString getPropertyValue(int propertyID) const;
    virtual bool getPropertyPriority(int propertyID) const;

    virtual void setProperty(int propertyId, const DOMString &value, bool important, int &exceptionCode);
    virtual DOMString removeProperty(int propertyID, int &exceptionCode);

    virtual CSSMutableStyleDeclarationImpl *copy() const;
    virtual CSSMutableStyleDeclarationImpl *makeMutable();

    QValueListConstIterator<CSSProperty> valuesIterator() const { return m_values.begin(); }

    bool setProperty(int propertyID, int value, bool important = false, bool notifyChanged = true);
    bool setProperty(int propertyID, const DOMString &value, bool important, bool notifyChanged, int &exceptionCode);
    bool setProperty(int propertyId, const DOMString &value, bool important = false, bool notifyChanged = true)
        { int exceptionCode; return setProperty(propertyId, value, important, notifyChanged, exceptionCode); }

    DOMString removeProperty(int propertyID, bool notifyChanged, int &exceptionCode);
    DOMString removeProperty(int propertyID, bool notifyChanged = true)
        { int exceptionCode; return removeProperty(propertyID, notifyChanged, exceptionCode); }

    void clear();

    void setChanged();
 
    // setLengthProperty treats integers as pixels! (Needed for conversion of HTML attributes.)
    void setLengthProperty(int propertyId, const DOMString &value, bool important, bool multiLength = false);
    void setStringProperty(int propertyId, const DOMString &value, CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value
    void setImageProperty(int propertyId, const DOMString &URL, bool important = false);
 
    // The following parses an entire new style declaration.
    void parseDeclaration(const DOMString &styleDeclaration);

    // Besides adding the properties, this also removes any existing properties with these IDs.
    // It does no notification since it's called by the parser.
    void addParsedProperties(const CSSProperty * const *, int numProperties);
 
    CSSMutableStyleDeclarationImpl *copyBlockProperties() const;
    void removeBlockProperties();
    void removeInheritableProperties();
    void removePropertiesInSet(const int *set, unsigned length);

    void merge(CSSMutableStyleDeclarationImpl *, bool argOverridesOnConflict = true);
 
private:
    DOMString getShortHandValue(const int* properties, int number) const;
    DOMString get4Values(const int* properties) const;
 
    QValueList<CSSProperty> m_values;
    NodeImpl *m_node;
};

} // namespace

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -