📄 render_style.h
字号:
// CSS3 User Drag Values
enum EUserDrag {
DRAG_AUTO, DRAG_NONE, DRAG_ELEMENT
};
// CSS3 User Select Values
enum EUserSelect {
SELECT_AUTO, SELECT_NONE, SELECT_TEXT
};
// Word Break Values. Matches WinIE, rather than CSS3
enum EWordWrap {
WBNORMAL, BREAK_WORD
};
enum ENBSPMode {
NBNORMAL, SPACE
};
enum EKHTMLLineBreak {
LBNORMAL, AFTER_WHITE_SPACE
};
enum EMatchNearestMailBlockquoteColor {
BCNORMAL, MATCH
};
// This struct is for rarely used non-inherited CSS3 properties. By grouping them together,
// we save space, and only allocate this object when someone actually uses
// a non-inherited CSS3 property.
class StyleCSS3NonInheritedData : public Shared<StyleCSS3NonInheritedData>
{
public:
StyleCSS3NonInheritedData();
~StyleCSS3NonInheritedData();
StyleCSS3NonInheritedData(const StyleCSS3NonInheritedData& o);
#ifndef KHTML_NO_XBL
bool bindingsEquivalent(const StyleCSS3NonInheritedData& o) const;
#endif
bool operator==(const StyleCSS3NonInheritedData& o) const;
bool operator!=(const StyleCSS3NonInheritedData &o) const {
return !(*this == o);
}
#if APPLE_CHANGES
int lineClamp; // An Apple extension. Not really CSS3 but not worth making a new struct over.
QValueList<StyleDashboardRegion> m_dashboardRegions;
#endif
float opacity; // Whether or not we're transparent.
DataRef<StyleFlexibleBoxData> flexibleBox; // Flexible box properties
DataRef<StyleMarqueeData> marquee; // Marquee properties
EUserDrag userDrag : 2; // Whether or not a drag can be initiated by this element.
EUserSelect userSelect : 2; // Whether or not the element is selectable.
bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
EMarginCollapse marginTopCollapse : 2;
EMarginCollapse marginBottomCollapse : 2;
EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor : 1;
#ifndef KHTML_NO_XBL
BindingURI* bindingURI; // The XBL binding URI list.
#endif
};
// This struct is for rarely used inherited CSS3 properties. By grouping them together,
// we save space, and only allocate this object when someone actually uses
// an inherited CSS3 property.
class StyleCSS3InheritedData : public Shared<StyleCSS3InheritedData>
{
public:
StyleCSS3InheritedData();
~StyleCSS3InheritedData();
StyleCSS3InheritedData(const StyleCSS3InheritedData& o);
bool operator==(const StyleCSS3InheritedData& o) const;
bool operator!=(const StyleCSS3InheritedData &o) const {
return !(*this == o);
}
bool shadowDataEquivalent(const StyleCSS3InheritedData& o) const;
ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
EUserModify userModify : 2; // Flag used for editing state
EWordWrap wordWrap : 1; // Flag used for word wrap
ENBSPMode nbspMode : 1;
EKHTMLLineBreak khtmlLineBreak : 1;
#if APPLE_CHANGES
bool textSizeAdjust : 1; // An Apple extension. Not really CSS3 but not worth making a new struct over.
#endif
private:
StyleCSS3InheritedData &operator=(const StyleCSS3InheritedData &);
};
//------------------------------------------------
// Inherited attributes.
//
enum EWhiteSpace {
NORMAL, PRE, NOWRAP, KHTML_NOWRAP
};
enum ETextAlign {
TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, KHTML_LEFT, KHTML_RIGHT, KHTML_CENTER
};
enum ETextTransform {
CAPITALIZE, UPPERCASE, LOWERCASE, TTNONE
};
enum EDirection {
LTR, RTL
};
enum ETextDecoration {
TDNONE = 0x0 , UNDERLINE = 0x1, OVERLINE = 0x2, LINE_THROUGH= 0x4, BLINK = 0x8
};
enum EPageBreak {
PBAUTO, PBALWAYS, PBAVOID
};
class StyleInheritedData : public Shared<StyleInheritedData>
{
public:
StyleInheritedData();
~StyleInheritedData();
StyleInheritedData(const StyleInheritedData& o );
bool operator==(const StyleInheritedData& o) const;
bool operator != ( const StyleInheritedData &o ) const {
return !(*this == o);
}
Length indent;
// could be packed in a short but doesn't
// make a difference currently because of padding
Length line_height;
CachedImage *style_image;
CachedImage *cursor_image;
khtml::Font font;
QColor color;
short horizontal_border_spacing;
short vertical_border_spacing;
// Paged media properties.
short widows;
short orphans;
EPageBreak page_break_inside : 2;
};
enum EEmptyCell {
SHOW, HIDE
};
enum ECaptionSide
{
CAPTOP, CAPBOTTOM, CAPLEFT, CAPRIGHT
};
enum EListStyleType {
DISC, CIRCLE, SQUARE, LDECIMAL, DECIMAL_LEADING_ZERO,
LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK,
LOWER_ALPHA, LOWER_LATIN, UPPER_ALPHA, UPPER_LATIN,
HEBREW, ARMENIAN, GEORGIAN, CJK_IDEOGRAPHIC,
HIRAGANA, KATAKANA, HIRAGANA_IROHA, KATAKANA_IROHA, LNONE
};
enum EListStylePosition { OUTSIDE, INSIDE };
enum EVisibility { VISIBLE, HIDDEN, COLLAPSE };
enum ECursor {
CURSOR_AUTO, CURSOR_CROSS, CURSOR_DEFAULT, CURSOR_POINTER, CURSOR_MOVE,
CURSOR_E_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_N_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE,
CURSOR_S_RESIZE, CURSOR_W_RESIZE, CURSOR_TEXT, CURSOR_WAIT, CURSOR_HELP
};
enum ContentType {
CONTENT_NONE, CONTENT_OBJECT, CONTENT_TEXT, CONTENT_COUNTER
};
struct ContentData {
ContentData() :_contentType(CONTENT_NONE), _nextContent(0) {}
~ContentData();
void clearContent();
ContentType contentType() { return _contentType; }
DOM::DOMStringImpl* contentText() { if (contentType() == CONTENT_TEXT) return _content.text; return 0; }
CachedObject* contentObject() { if (contentType() == CONTENT_OBJECT) return _content.object; return 0; }
ContentType _contentType;
union {
CachedObject* object;
DOM::DOMStringImpl* text;
// counters...
} _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, BOX, INLINE_BOX, NONE
};
class RenderStyle
OOM_MODIFIED
{
friend class CSSStyleSelector;
public:
static void cleanup();
// static pseudo styles. Dynamic ones are produced on the fly.
enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED };
void ref() { m_ref++; }
void deref(RenderArena* arena) {
if (m_ref) m_ref--;
if (!m_ref)
arenaDelete(arena);
}
bool hasOneRef() { return m_ref==1; }
int refCount() const { return m_ref; }
// Overloaded new operator. Derived classes must override operator new
// in order to allocate out of the RenderArena.
void* operator new(size_t sz, RenderArena* renderArena) throw();
// Overridden to prevent the normal delete from being called.
void operator delete(void* ptr, size_t sz);
private:
void arenaDelete(RenderArena *arena);
protected:
// !START SYNC!: Keep this in sync with the copy constructor in render_style.cpp
// inherit
struct InheritedFlags {
bool operator==( const InheritedFlags &other ) const {
return (_empty_cells == other._empty_cells) &&
(_caption_side == other._caption_side) &&
(_list_style_type == other._list_style_type) &&
(_list_style_position == other._list_style_position) &&
(_visibility == other._visibility) &&
(_text_align == other._text_align) &&
(_text_transform == other._text_transform) &&
(_text_decorations == other._text_decorations) &&
(_text_transform == other._text_transform) &&
(_cursor_style == other._cursor_style) &&
(_direction == other._direction) &&
(_border_collapse == other._border_collapse) &&
(_white_space == other._white_space) &&
(_box_direction == other._box_direction) &&
(_visuallyOrdered == other._visuallyOrdered) &&
(_htmlHacks == other._htmlHacks) &&
(_force_backgrounds_to_white == other._force_backgrounds_to_white);
}
bool operator!=( const InheritedFlags &other ) const {
return !(*this == other);
}
EEmptyCell _empty_cells : 1 ;
ECaptionSide _caption_side : 2;
EListStyleType _list_style_type : 5 ;
EListStylePosition _list_style_position :1;
EVisibility _visibility : 2;
ETextAlign _text_align : 4;
ETextTransform _text_transform : 2;
int _text_decorations : 4;
ECursor _cursor_style : 4;
EDirection _direction : 1;
bool _border_collapse : 1 ;
EWhiteSpace _white_space : 2;
EBoxDirection _box_direction : 1; // CSS3 box_direction property (flexible box layout module)
// non CSS2 inherited
bool _visuallyOrdered : 1;
bool _htmlHacks :1;
bool _force_backgrounds_to_white : 1;
} inherited_flags;
// don't inherit
struct NonInheritedFlags {
bool operator==( const NonInheritedFlags &other ) const {
return (_effectiveDisplay == other._effectiveDisplay) &&
(_originalDisplay == other._originalDisplay) &&
(_bg_repeat == other._bg_repeat) &&
(_overflow == other._overflow) &&
(_vertical_align == other._vertical_align) &&
(_clear == other._clear) &&
(_position == other._position) &&
(_floating == other._floating) &&
(_table_layout == other._table_layout) &&
(_page_break_before == other._page_break_before) &&
(_page_break_after == other._page_break_after) &&
(_styleType == other._styleType) &&
(_affectedByHover == other._affectedByHover) &&
(_affectedByActive == other._affectedByActive) &&
(_affectedByDrag == other._affectedByDrag) &&
(_pseudoBits == other._pseudoBits) &&
(_unicodeBidi == other._unicodeBidi);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -