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

📄 render_style.h

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 H
📖 第 1 页 / 共 4 页
字号:
enum EQuoteContent {    NO_QUOTE, OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE};enum ContentType {    CONTENT_NONE, CONTENT_OBJECT, CONTENT_TEXT,    CONTENT_ATTR, CONTENT_COUNTER, CONTENT_QUOTE};struct ContentData {    ContentData() : _contentType( CONTENT_NONE ), _nextContent(0) {}    ~ContentData();    void clearContent();    ContentType _contentType;    DOM::DOMStringImpl* contentText()    { if (_contentType == CONTENT_TEXT) return _content.text; return 0; }    CachedObject* contentObject()    { if (_contentType == CONTENT_OBJECT) return _content.object; return 0; }    DOM::CounterImpl* contentCounter()    { if (_contentType == CONTENT_COUNTER) return _content.counter; return 0; }    EQuoteContent contentQuote()    { if (_contentType == CONTENT_QUOTE) return _content.quote; return NO_QUOTE; }    union {        CachedObject* object;        DOM::DOMStringImpl* text;        DOM::CounterImpl* counter;        EQuoteContent quote;    } _content ;    ContentData* _nextContent;};//------------------------------------------------enum EDisplay {    INLINE, BLOCK, LIST_ITEM, RUN_IN,    COMPACT, INLINE_BLOCK, TABLE, INLINE_TABLE,    TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,    TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,    TABLE_CAPTION, NONE};class RenderStyle : public Shared<RenderStyle>{    friend class CSSStyleSelector;public:    KDE_EXPORT static void cleanup();    // static pseudo styles. Dynamic ones are produced on the fly.    enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION };protected:// !START SYNC!: Keep this in sync with the copy constructor in render_style.cpp    // inherit    struct InheritedFlags {    // 64 bit inherited, update unused when adding to the struct, or the operator will break.	bool operator==( const InheritedFlags &other ) const        {    return _iflags ==other._iflags;    }	bool operator!=( const InheritedFlags &other ) const        {    return _iflags != other._iflags;   }        union {            struct {                EEmptyCell _empty_cells : 1 ;                ECaptionSide _caption_side : 2;                EListStyleType _list_style_type : 6;                EListStylePosition _list_style_position :1;                EVisibility _visibility : 2;                ETextAlign _text_align : 4;                ETextTransform _text_transform : 2;                unsigned _text_decorations : 4;                ECursor _cursor_style : 5;                EDirection _direction : 1;                bool _border_collapse : 1 ;                EWhiteSpace _white_space : 3;                // non CSS2 inherited                bool _visuallyOrdered : 1;                bool _htmlHacks :1;                EUserInput _user_input : 2;                bool _page_break_inside : 1; // AUTO/AVOID                unsigned int unused : 27;            } f;            Q_UINT64 _iflags;        };    } inherited_flags;// don't inherit    struct NonInheritedFlags {    // 64 bit non-inherited, update unused when adding to the struct, or the operator will break.	bool operator==( const NonInheritedFlags &other ) const        {   return _niflags == other._niflags;    }	bool operator!=( const NonInheritedFlags &other ) const        {   return _niflags != other._niflags;    }        union {            struct {                EDisplay _display : 5;                EDisplay _originalDisplay: 5;                EOverflow _overflow : 4 ;                EVerticalAlign _vertical_align : 4;                EClear _clear : 2;                EPosition _position : 2;                EFloat _floating : 3;                ETableLayout _table_layout : 1;                bool _flowAroundFloats :1;                EPageBreak _page_break_before : 3;                EPageBreak _page_break_after : 3;                PseudoId _styleType : 4;		bool _affectedByHover : 1;		bool _affectedByActive : 1;                bool _hasClip : 1;                EUnicodeBidi _unicodeBidi : 2;                unsigned int unused : 22;            } f;            Q_UINT64 _niflags;        };    } noninherited_flags;// non-inherited attributes    DataRef<StyleBoxData> box;    DataRef<StyleVisualData> visual;    DataRef<StyleBackgroundData> background;    DataRef<StyleSurroundData> surround;    DataRef<StyleCSS3NonInheritedData> css3NonInheritedData;// inherited attributes    DataRef<StyleCSS3InheritedData> css3InheritedData;    DataRef<StyleInheritedData> inherited;// list of associated pseudo styles    RenderStyle* pseudoStyle;    // added this here, so we can get rid of the vptr in this class.    // makes up for the same size.    ContentData *content;    DOM::CSSValueListImpl *counter_reset;    DOM::CSSValueListImpl *counter_increment;// !END SYNC!// static default style    static RenderStyle* _default;private:    RenderStyle(const RenderStyle*) {}protected:    void setBitDefaults()    {        inherited_flags.f._empty_cells = initialEmptyCells();        inherited_flags.f._caption_side = initialCaptionSide();	inherited_flags.f._list_style_type = initialListStyleType();	inherited_flags.f._list_style_position = initialListStylePosition();	inherited_flags.f._visibility = initialVisibility();	inherited_flags.f._text_align = initialTextAlign();	inherited_flags.f._text_transform = initialTextTransform();	inherited_flags.f._text_decorations = initialTextDecoration();	inherited_flags.f._cursor_style = initialCursor();	inherited_flags.f._direction = initialDirection();	inherited_flags.f._border_collapse = initialBorderCollapse();	inherited_flags.f._white_space = initialWhiteSpace();	inherited_flags.f._visuallyOrdered = false;	inherited_flags.f._htmlHacks=false;	inherited_flags.f._user_input = UI_NONE;	inherited_flags.f._page_break_inside = true;        inherited_flags.f.unused = 0;	noninherited_flags._niflags = 0L; // for safety: without this, the equality method sometimes	                                  // makes use of uninitialised bits according to valgrind        noninherited_flags.f._display = noninherited_flags.f._originalDisplay = initialDisplay();	noninherited_flags.f._overflow = initialOverflow();	noninherited_flags.f._vertical_align = initialVerticalAlign();	noninherited_flags.f._clear = initialClear();	noninherited_flags.f._position = initialPosition();	noninherited_flags.f._floating = initialFloating();	noninherited_flags.f._table_layout = initialTableLayout();	noninherited_flags.f._flowAroundFloats= initialFlowAroundFloats();        noninherited_flags.f._page_break_before = initialPageBreak();        noninherited_flags.f._page_break_after = initialPageBreak();	noninherited_flags.f._styleType = NOPSEUDO;	noninherited_flags.f._affectedByHover = false;	noninherited_flags.f._affectedByActive = false;	noninherited_flags.f._hasClip = false;	noninherited_flags.f._unicodeBidi = initialUnicodeBidi();        noninherited_flags.f.unused = 0;    }public:    RenderStyle();    // used to create the default style.    RenderStyle(bool);    RenderStyle(const RenderStyle&);    ~RenderStyle();    void inheritFrom(const RenderStyle* inheritParent);    PseudoId styleType() { return  noninherited_flags.f._styleType; }    RenderStyle* getPseudoStyle(PseudoId pi);    RenderStyle* addPseudoStyle(PseudoId pi);    void removePseudoStyle(PseudoId pi);    bool affectedByHoverRules() const { return  noninherited_flags.f._affectedByHover; }    bool affectedByActiveRules() const { return  noninherited_flags.f._affectedByActive; }    void setAffectedByHoverRules(bool b) {  noninherited_flags.f._affectedByHover = b; }    void setAffectedByActiveRules(bool b) {  noninherited_flags.f._affectedByActive = b; }    bool operator==(const RenderStyle& other) const;    bool        isFloating() const { return !(noninherited_flags.f._floating == FNONE); }    bool        hasMargin() const { return surround->margin.nonZero(); }    bool        hasBorder() const { return surround->border.hasBorder(); }    bool        hasOffset() const { return surround->offset.nonZero(); }    bool hasBackground() const {        if (backgroundColor().isValid() && qAlpha(backgroundColor().rgb()) > 0)            return true;        else            return background->m_background.hasImage();    }    bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }    bool visuallyOrdered() const { return inherited_flags.f._visuallyOrdered; }    void setVisuallyOrdered(bool b) {  inherited_flags.f._visuallyOrdered = b; }// attribute getter methods    EDisplay 	display() const { return noninherited_flags.f._display; }    EDisplay    originalDisplay() const { return noninherited_flags.f._originalDisplay; }    Length  	left() const {  return surround->offset.left; }    Length  	right() const {  return surround->offset.right; }    Length  	top() const {  return surround->offset.top; }    Length  	bottom() const {  return surround->offset.bottom; }    EPosition 	position() const { return  noninherited_flags.f._position; }    EFloat  	floating() const { return  noninherited_flags.f._floating; }    Length  	width() const { return box->width; }    Length  	height() const { return box->height; }    Length  	minWidth() const { return box->min_width; }    Length  	maxWidth() const { return box->max_width; }    Length  	minHeight() const { return box->min_height; }    Length  	maxHeight() const { return box->max_height; }    const BorderValue& borderLeft() const { return surround->border.left; }    const BorderValue& borderRight() const { return surround->border.right; }    const BorderValue& borderTop() const { return surround->border.top; }    const BorderValue& borderBottom() const { return surround->border.bottom; }    unsigned short  borderLeftWidth() const    { if( surround->border.left.style == BNONE || surround->border.left.style == BNATIVE) return 0; return surround->border.left.width; }    EBorderStyle    borderLeftStyle() const { return surround->border.left.style; }    const QColor &  borderLeftColor() const { return surround->border.left.color; }    bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }    unsigned short  borderRightWidth() const    { if (surround->border.right.style == BNONE || surround->border.left.style == BNATIVE) return 0; return surround->border.right.width; }    EBorderStyle    borderRightStyle() const {  return surround->border.right.style; }    const QColor &  	    borderRightColor() const {  return surround->border.right.color; }    bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }    unsigned short  borderTopWidth() const    { if(surround->border.top.style == BNONE || surround->border.left.style == BNATIVE) return 0; return surround->border.top.width; }    EBorderStyle    borderTopStyle() const {return surround->border.top.style; }    const QColor &  borderTopColor() const {  return surround->border.top.color; }    bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }    unsigned short  borderBottomWidth() const    { if(surround->border.bottom.style == BNONE || surround->border.left.style == BNATIVE) return 0; return surround->border.bottom.width; }    EBorderStyle    borderBottomStyle() const {  return surround->border.bottom.style; }    const QColor &  	    borderBottomColor() const {  return surround->border.bottom.color; }    bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }    unsigned short  outlineSize() const { return outlineWidth() + outlineOffset(); }    unsigned short  outlineWidth() const    { if(background->m_outline.style == BNONE || background->m_outline.style == BHIDDEN) return 0;      else return background->m_outline.width; }    EBorderStyle    outlineStyle() const {  return background->m_outline.style; }    bool outlineStyleIsAuto() const { return background->m_outline._auto; }    const QColor &  outlineColor() const {  return background->m_outline.color; }    EOverflow overflow() const { return  noninherited_flags.f._overflow; }    bool hidesOverflow() const { return overflow() != OVISIBLE; }    bool scrollsOverflow() const { return overflow() == OSCROLL || overflow() == OAUTO; }    EVisibility visibility() const { return inherited_flags.f._visibility; }    EVerticalAlign verticalAlign() const { return  noninherited_flags.f._vertical_align; }    Length verticalAlignLength() const { return box->vertical_align; }    Length clipLeft() const { return visual->clip.left; }    Length clipRight() const { return visual->clip.right; }    Length clipTop() const { return visual->clip.top; }    Length clipBottom() const { return visual->clip.bottom; }    bool hasClip() const { return noninherited_flags.f._hasClip; }    EUnicodeBidi unicodeBidi() const { return noninherited_flags.f._unicodeBidi; }    EClear clear() const { return  noninherited_flags.f._clear; }    ETableLayout tableLayout() const { return  noninherited_flags.f._table_layout; }    const QFont & font() const { return inherited->font.f; }    // use with care. call font->update() after modifications    const Font &htmlFont() { return inherited->font; }    const QFontMetrics & fontMetrics() const { return inherited->font.fm; }    const QColor & color() const { return inherited->color; }    Length textIndent() const { return inherited->indent; }    ETextAlign textAlign() const { return inherited_flags.f._text_align; }    ETextTransform textTransform() const { return inherited_flags.f._text_transform; }    int textDecorationsInEffect() const { return inherited_flags.f._text_decorations; }    int textDecoration() const { return visual->textDecoration; }    int wordSpacing() const { return inherited->font.wordSpacing; }    int letterSpacing() const { return inherited->font.letterSpacing; }    EDirection direction() const { return inherited_flags.f._direction; }    Length lineHeight() const { return inherited->line_height; }    EWhiteSpace whiteSpace() const { return inherited_flags.f._white_space; }    bool autoWrap() const {        if (whiteSpace() == NORMAL || whiteSpace() == PRE_WRAP || whiteSpace() == PRE_LINE)            return true;        // nowrap | pre        return false;    }    bool preserveLF() const {        if (whiteSpace() == PRE || whiteSpace() == PRE_WRAP || whiteSpace() == PRE_LINE)            return true;        // normal | nowrap        return false;    }    bool preserveWS() const {        if (whiteSpace() == PRE || whiteSpace() == PRE_WRAP)            return true;        // normal | nowrap | pre-line        return false;    }    const QColor & backgroundColor() const { return background->m_color; }    CachedImage *backgroundImage() const { return background->m_background.m_image; }    EBackgroundRepeat backgroundRepeat() const { return background->m_background.m_bgRepeat; }    bool backgroundAttachment() const { return background->m_background.m_bgAttachment; }

⌨️ 快捷键说明

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