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

📄 render_style.h

📁 将konqueror浏览器移植到ARM9 2410中
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * This file is part of the DOM implementation for KDE. * * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * $Id: render_style.h,v 1.40.2.1 2001/11/01 18:57:06 mueller Exp $ */#ifndef RENDERSTYLE_H#define RENDERSTYLE_H/* * WARNING: * -------- * * The order of the values in the enums have to agree with the order specified * in cssvalues.in, otherwise some optimizations in the parser will fail, * and produce invaliud results. */#include <qcolor.h>#include <qfont.h>#include <qlist.h>#include <qpalette.h>#include <qapplication.h>#include "dom/dom_misc.h"#include <khtmllayout.h>#define SET_VAR(group,variable,value) \    if (group->variable != value) \        group.access()->variable = value;namespace khtml {    class CachedImage;template <class DATA>class DataRef{public:    DataRef()    {	data=0;    }    virtual ~DataRef()    {    	if(data) data->deref();    }    const DATA* operator->() const    {    	return data;    }    const DATA* get() const    {    	return data;    }    DATA* access()    {    	if (!data->hasOneRef())	{	    data->deref();	    data = new DATA(*data);	    data->ref();	}	return data;    }    void init()    {    	if (data)    	    data->deref();    	data = new DATA;	data->ref();    }    DataRef<DATA>& operator=(const DataRef<DATA>& d)    {    	if (data==d.data)	    return *this;    	if (data)    	    data->deref();    	data = d.data;	data->ref();	return *this;    }private:    DATA* data;};class SharedData{public:    SharedData() { _ref=0; /*counter++;*/ }    virtual ~SharedData() { /*counter--;*/ }    void ref() { _ref++;  }    void deref() { if(_ref) _ref--; if(_ref<=0) delete this; }    bool hasOneRef() { //kdDebug(300) << "ref=" << _ref << endl;    	return _ref==1; }//    static int counter;protected:    unsigned int _ref;};//------------------------------------------------//------------------------------------------------// Box model attributes. Not inherited.struct LengthBox{    LengthBox()    {    }    Length left;    Length right;    Length top;    Length bottom;    Length& operator=(Length& len)    {    	left=len;	right=len;	top=len;	bottom=len;	return len;    }    bool operator==(const LengthBox& o) const    {    	return left==o.left && right==o.right && top==o.top && bottom==o.bottom;    }    bool nonZero() const { return left.value!=0 || right.value!=0 || top.value!=0 || bottom.value!=0; }};enum EPosition {    STATIC, RELATIVE, ABSOLUTE, FIXED};enum EFloat {    FNONE, FLEFT, FRIGHT};//------------------------------------------------// Border attributes. Not inherited.enum EBorderStyle {    BNONE, BHIDDEN, DOTTED, DASHED, SOLID, DOUBLE,    GROOVE, RIDGE, INSET, OUTSET};class BorderValue{public:    BorderValue()    {	width = 3; // medium is default value	style = BNONE;    }    QColor color;    unsigned short width : 12;    EBorderStyle style : 4;    bool nonZero() const { return width!=0 && style!=BNONE; }    bool operator==(const BorderValue& o) const    {    	return width==o.width && style==o.style && color==o.color;    }};class BorderData : public SharedData{public:    BorderValue left;    BorderValue right;    BorderValue top;    BorderValue bottom;    bool hasBorder() const    {    	return left.nonZero() || right.nonZero() || top.nonZero() || bottom.nonZero();    }    bool operator==(const BorderData& o) const    {    	return left==o.left && right==o.right && top==o.top && bottom==o.bottom;    }};class StyleSurroundData : public SharedData{public:    StyleSurroundData();    StyleSurroundData(const StyleSurroundData& o );    bool operator==(const StyleSurroundData& o) const;    LengthBox offset;    LengthBox margin;    LengthBox padding;    BorderData border;    BorderValue outline;};//------------------------------------------------// Box attributes. Not inherited.const int ZAUTO=0;class StyleBoxData : public SharedData{public:    StyleBoxData();    StyleBoxData(const StyleBoxData& o );    // copy and assignment//    StyleBoxData(const StyleBoxData &other);//    const StyleBoxData &operator = (const StyleBoxData &other);    void setDefaultValues()    {    	z_index = ZAUTO;    }    bool operator==(const StyleBoxData& o) const;    Length width;    Length height;    Length min_width;    Length max_width;    Length min_height;    Length max_height;    Length vertical_align;    int z_index;};//------------------------------------------------// Random visual rendering model attributes. Not inherited.enum EOverflow {    OVISIBLE, OHIDDEN, SCROLL, AUTO};enum EVerticalAlign {    BASELINE, MIDDLE, SUB, SUPER, TEXT_TOP,    TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH};enum EClear{    CNONE = 0, CLEFT = 1, CRIGHT = 2, CBOTH = 3};enum ETableLayout {    TAUTO, TFIXED};class StyleVisualData : public SharedData{public:    StyleVisualData();    virtual ~StyleVisualData();    StyleVisualData(const StyleVisualData& o );    LengthBox clip;    short colspan; // for html, not a css2 attribute    short counter_increment; //ok, so these are not visual mode spesific    short counter_reset;     //can't go to inherited, since these are not inherited    QPalette palette;      //widget styling with IE attributes};//------------------------------------------------enum EBackgroundRepeat {    REPEAT, REPEAT_X, REPEAT_Y, NO_REPEAT};class StyleBackgroundData : public SharedData{public:    StyleBackgroundData()    {	image = 0;    }    virtual ~StyleBackgroundData()    {    }    StyleBackgroundData(const StyleBackgroundData& o ) : SharedData()    {    	color = o.color;	image = o.image;	x_position = o.x_position;	y_position = o.y_position;    }    bool operator==(const StyleBackgroundData& o) const    {    	return	    color == o.color &&	    image == o.image &&	    x_position == o.x_position &&	    y_position == o.y_position;    }    QColor color;    CachedImage *image;    Length x_position;    Length y_position;};//------------------------------------------------// Inherited attributes.//// the inherited-decoration and inherited-shadow attributes// are inherited from the// first parent which is block level//// this applies to decoration_color tooenum EWhiteSpace {    NORMAL, PRE, NOWRAP};enum ETextAlign {    LEFT, RIGHT, CENTER, JUSTIFY, KONQ_CENTER};enum ETextTransform {    CAPITALIZE, UPPERCASE, LOWERCASE, TTNONE};enum EDirection {    LTR, RTL};enum ETextDecoration {    TDNONE = 0x0 , UNDERLINE = 0x1, OVERLINE = 0x2, LINE_THROUGH= 0x4, BLINK = 0x8};class StyleInheritedData : public SharedData{public:    void setDefaultValues()    {	letter_spacing = 0;	word_spacing = 0;	line_height = Length(-100, Percent);	indent = Length(0, Fixed);	border_spacing = 0;	style_image = 0;	cursor_image = 0;    }    StyleInheritedData() { setDefaultValues(); }    virtual ~StyleInheritedData() { }    StyleInheritedData(const StyleInheritedData& o ) : SharedData()    {	indent = o.indent;	line_height = o.line_height;	letter_spacing = o.letter_spacing;	border_spacing = o.border_spacing;	style_image = o.style_image;	cursor_image = o.cursor_image;	font = o.font;	color = o.color;	decoration_color = o.decoration_color;

⌨️ 快捷键说明

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