亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cssparser.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/*
 * This file is part of the DOM implementation for KDE.
 *
 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
 * Copyright (C) 2004 Apple Computer, Inc.
 *
 * 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.
 */

// #define CSS_DEBUG
// #define TOKEN_DEBUG
#define YYDEBUG 0

#include <kdebug.h>
#include <kurl.h>

#include "cssparser.h"
#include "css_valueimpl.h"
#include "css_ruleimpl.h"
#include "css_stylesheetimpl.h"
#include "cssproperties.h"
#include "cssvalues.h"
#include "misc/helper.h"
#include "xml/dom_docimpl.h"
#include "csshelper.h"
using namespace DOM;

#include <stdlib.h>

#if APPLE_CHANGES
void qFatal ( const char * msg ) {}
#endif

#ifdef __OOM__
#include <allocs.h>
#endif

ValueList::ValueList()
{
    values = (Value *) malloc( 16 * sizeof ( Value ) );
    numValues = 0;
    currentValue = 0;
    maxValues = 16;
}

ValueList::~ValueList()
{
    for ( int i = 0; i < numValues; i++ ) {
#ifdef CSS_DEBUG
	kdDebug( 6080 ) << "       value: (unit=" << values[i].unit <<")"<< endl;
#endif
	if ( values[i].unit == Value::Function )
	    delete values[i].function;
    }
    free( values );
}

void ValueList::addValue( const Value &val )
{
    if ( numValues >= maxValues ) {
	maxValues += 16;
	values = (Value *) realloc( values, maxValues*sizeof( Value ) );
    }
    values[numValues++] = val;
}


using namespace DOM;

#if YYDEBUG > 0
extern int cssyydebug;
#endif

extern int cssyyparse( void * parser );

CSSParser *CSSParser::currentParser = 0;

CSSParser::CSSParser( bool strictParsing )
{
#ifdef CSS_DEBUG
    kdDebug( 6080 ) << "CSSParser::CSSParser this=" << this << endl;
#endif
    strict = strictParsing;

    parsedProperties = (CSSProperty **) malloc( 32 * sizeof( CSSProperty * ) );
    numParsedProperties = 0;
    maxParsedProperties = 32;

    data = 0;
    valueList = 0;
    rule = 0;
    id = 0;
    important = false;
    inParseShortHand = false;

    defaultNamespace = anyNamespace;

    yy_start = 1;

#if YYDEBUG > 0
    cssyydebug = 1;
#endif

}

CSSParser::~CSSParser()
{
    if ( numParsedProperties )
	clearProperties();
    free( parsedProperties );

    delete valueList;

#ifdef CSS_DEBUG
    kdDebug( 6080 ) << "CSSParser::~CSSParser this=" << this << endl;
#endif

    free( data );

}

void ParseString::lower()
{
    for (int i = 0; i < length; i++)
        string[i] = QChar(string[i]).lower().unicode();
}

void CSSParser::setupParser(const char *prefix, const DOMString &string, const char *suffix)
{
    int length = string.length() + strlen(prefix) + strlen(suffix) + 2;

    data = (unsigned short *)malloc( length *sizeof( unsigned short ) );
    for ( unsigned int i = 0; i < strlen(prefix); i++ )
	data[i] = prefix[i];

    memcpy( data + strlen( prefix ), string.unicode(), string.length()*sizeof( unsigned short) );

    unsigned int start = strlen( prefix ) + string.length();
    unsigned int end = start + strlen(suffix);
    for ( unsigned int i = start; i < end; i++ )
        data[i] = suffix[i-start];

    data[length-1] = 0;
    data[length-2] = 0;

    yy_hold_char = 0;
    yyleng = 0;
    yytext = yy_c_buf_p = data;
    yy_hold_char = *yy_c_buf_p;
}

void CSSParser::parseSheet( CSSStyleSheetImpl *sheet, const DOMString &string )
{
    styleElement = sheet;
    defaultNamespace = anyNamespace; // Reset the default namespace.

    setupParser ("", string, "");

#ifdef CSS_DEBUG
    kdDebug( 6080 ) << ">>>>>>> start parsing style sheet" << endl;
#endif
    CSSParser *old = currentParser;
    currentParser = this;
    cssyyparse( this );
    currentParser = old;
#ifdef CSS_DEBUG
    kdDebug( 6080 ) << "<<<<<<< done parsing style sheet" << endl;
#endif

    delete rule;
    rule = 0;
}

CSSRuleImpl *CSSParser::parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string )
{
    styleElement = sheet;

    setupParser ("@-khtml-rule{", string, "} ");

    CSSParser *old = currentParser;
    currentParser = this;
    cssyyparse( this );
    currentParser = old;

    CSSRuleImpl *result = rule;
    rule = 0;

    return result;
}

bool CSSParser::parseValue( CSSMutableStyleDeclarationImpl *declaration, int _id, const DOMString &string,
			    bool _important)
{
#ifdef CSS_DEBUG
    kdDebug( 6080 ) << "CSSParser::parseValue: id=" << _id << " important=" << _important
		    << " value='" << string.string() << "'" << endl;
#endif

    styleElement = declaration->stylesheet();

    setupParser ("@-khtml-value{", string, "} ");

    id = _id;
    important = _important;

    CSSParser *old = currentParser;
    currentParser = this;
    cssyyparse( this );
    currentParser = old;

    delete rule;
    rule = 0;

    bool ok = false;
    if ( numParsedProperties ) {
	ok = true;
        declaration->addParsedProperties(parsedProperties, numParsedProperties);
        clearProperties();
    }

    return ok;
}

QRgb CSSParser::parseColor( const DOM::DOMString &string )
{
    QRgb color = 0;
    CSSMutableStyleDeclarationImpl *dummyStyleDeclaration = new CSSMutableStyleDeclarationImpl;

    dummyStyleDeclaration->ref();

    DOM::CSSParser parser(true);

    // First try creating a color specified by name or the "#" syntax.
    if (!parser.parseColor(string.string(), color)) {

        // Now try to create a color from the rgb() or rgba() syntax.
        bool ok = parser.parseColor(dummyStyleDeclaration, string);
        if ( ok ) {
            CSSValueImpl *value = parser.parsedProperties[0]->value();
            if (value->cssValueType() == DOM::CSSValue::CSS_PRIMITIVE_VALUE) {
                DOM::CSSPrimitiveValueImpl *primitiveValue = static_cast<DOM::CSSPrimitiveValueImpl *>(value);
                color = primitiveValue->getRGBColorValue();
            }
        }

    }

    dummyStyleDeclaration->deref();

    return color;
}

bool CSSParser::parseColor( CSSMutableStyleDeclarationImpl *declaration, const DOMString &string )
{
    styleElement = declaration->stylesheet();

    setupParser ( "@-khtml-decls{color:", string, "} ");

    CSSParser *old = currentParser;
    currentParser = this;
    cssyyparse( this );
    currentParser = old;

    delete rule;
    rule = 0;

    bool ok = false;
    if ( numParsedProperties && parsedProperties[0]->m_id == CSS_PROP_COLOR) {
	ok = true;
    }

    return ok;
}

bool CSSParser::parseDeclaration( CSSMutableStyleDeclarationImpl *declaration, const DOMString &string )
{
#ifdef CSS_DEBUG
    kdDebug( 6080 ) << "CSSParser::parseDeclaration:value='" << string.string() << "'" << endl;
#endif

    styleElement = declaration->stylesheet();

    setupParser ( "@-khtml-decls{", string, "} ");

    CSSParser *old = currentParser;
    currentParser = this;
    cssyyparse( this );
    currentParser = old;

    delete rule;
    rule = 0;

    bool ok = false;
    if ( numParsedProperties ) {
	ok = true;
        declaration->addParsedProperties(parsedProperties, numParsedProperties);
        clearProperties();
    }

    return ok;
}


void CSSParser::addProperty( int propId, CSSValueImpl *value, bool important )
{
    CSSProperty *prop = new CSSProperty;
    prop->m_id = propId;
    prop->setValue( value );
    prop->m_bImportant = important;

    if ( numParsedProperties >= maxParsedProperties ) {
	maxParsedProperties += 32;
	parsedProperties = (CSSProperty **) realloc( parsedProperties,
						    maxParsedProperties*sizeof( CSSProperty * ) );
    }
    parsedProperties[numParsedProperties++] = prop;
}

CSSMutableStyleDeclarationImpl *CSSParser::createStyleDeclaration( CSSStyleRuleImpl *rule )
{
    CSSMutableStyleDeclarationImpl *result = new CSSMutableStyleDeclarationImpl(rule, parsedProperties, numParsedProperties);
    clearProperties();
    return result;
}

void CSSParser::clearProperties()
{
    for ( int i = 0; i < numParsedProperties; i++ )
	delete parsedProperties[i];
    numParsedProperties = 0;
}

DOM::DocumentImpl *CSSParser::document() const
{
    StyleBaseImpl *root = styleElement;
    DocumentImpl *doc = 0;
    while (root->parent())
	root = root->parent();
    if (root->isCSSStyleSheet())
	doc = static_cast<CSSStyleSheetImpl*>(root)->doc();
    return doc;
}


// defines units allowed for a certain property, used in parseUnit
enum Units
{
    FUnknown   = 0x0000,
    FInteger   = 0x0001,
    FNumber    = 0x0002,  // Real Numbers
    FPercent   = 0x0004,
    FLength    = 0x0008,
    FAngle     = 0x0010,
    FTime      = 0x0020,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩精品二区第二页| 亚洲视频免费在线| 亚洲私人影院在线观看| 男女男精品视频网| 99久久夜色精品国产网站| 欧美一区二区福利视频| 亚洲欧美国产高清| 丁香天五香天堂综合| 91精品中文字幕一区二区三区| 国产精品国产自产拍在线| 极品少妇一区二区| 欧美久久免费观看| 亚洲综合免费观看高清完整版在线| 韩国午夜理伦三级不卡影院| 欧美另类高清zo欧美| 亚洲美女精品一区| 成人黄色免费短视频| 久久天堂av综合合色蜜桃网| 日韩av电影天堂| 欧美日韩卡一卡二| 亚洲精品视频在线看| 91亚洲午夜精品久久久久久| 国产网站一区二区| 国产精品自拍网站| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 久久久久久久久久美女| 日韩精品久久理论片| 欧美日韩亚洲综合| 亚洲成人福利片| 在线观看国产一区二区| 亚洲精品国产成人久久av盗摄 | 日本少妇一区二区| 欧美日韩中字一区| 亚洲丰满少妇videoshd| 欧美日韩精品二区第二页| 亚洲 欧美综合在线网络| 欧美日韩在线一区二区| 天天射综合影视| 日韩一区二区在线播放| 乱一区二区av| 久久久久9999亚洲精品| 成人激情电影免费在线观看| 亚洲欧美综合在线精品| 91国内精品野花午夜精品| 亚洲一区二区在线观看视频 | 99国产精品国产精品久久| 国产精品灌醉下药二区| 欧美亚洲自拍偷拍| 日本亚洲最大的色成网站www| 欧美精选一区二区| 成人福利视频网站| 亚洲色图20p| 欧美日韩成人激情| 极品销魂美女一区二区三区| 国产精品区一区二区三区| 99视频精品在线| 亚洲成a人片综合在线| 精品乱人伦小说| 99久久er热在这里只有精品66| 亚洲自拍另类综合| 欧美成人午夜电影| 99国产精品国产精品久久| 午夜精品福利一区二区三区蜜桃| 欧美精品一区二区三区视频| 99久久精品久久久久久清纯| 日本一区中文字幕 | 一区二区三区在线观看动漫| 欧美一区二区精品久久911| 国产激情一区二区三区四区 | 亚洲欧洲一区二区三区| 91精品久久久久久蜜臀| 国产999精品久久| 丝袜亚洲另类丝袜在线| 中文字幕+乱码+中文字幕一区| 欧美这里有精品| 国产.精品.日韩.另类.中文.在线.播放| 亚洲精品久久久蜜桃| 欧美精品一区二区三区久久久| 91久久国产最好的精华液| 久久成人免费日本黄色| 亚洲国产精品一区二区久久| 精品国产一区a| 欧美午夜精品一区二区三区| 国产精品888| 日本成人中文字幕在线视频| 亚洲美女视频一区| 国产肉丝袜一区二区| 91麻豆精品国产91久久久资源速度 | 国产一区二区中文字幕| 亚洲aaa精品| 亚洲女同ⅹxx女同tv| 日本一区二区三级电影在线观看| 日韩一区二区电影网| 欧美系列亚洲系列| 91天堂素人约啪| 国产成人免费视频网站| 久久国产尿小便嘘嘘| 亚洲成av人片一区二区| 一区二区三区在线影院| 日韩一区欧美一区| 国产日韩欧美激情| 亚洲精品一区二区三区蜜桃下载| 欧美日韩国产小视频| 91黄视频在线观看| eeuss鲁片一区二区三区在线看| 国产九色sp调教91| 韩日欧美一区二区三区| 九九精品视频在线看| 久久精品免费观看| 麻豆精品蜜桃视频网站| 蜜臀av国产精品久久久久| 婷婷六月综合亚洲| 日韩和欧美的一区| 免费在线看成人av| 另类小说欧美激情| 免费观看在线色综合| 日本在线不卡一区| 精品一区二区三区免费毛片爱| 久久精品久久久精品美女| 精品亚洲免费视频| 国产成人av电影在线观看| 不卡的电视剧免费网站有什么| 国产成人精品一区二区三区四区 | 激情国产一区二区| 国产精品自拍三区| 成人综合婷婷国产精品久久| 粉嫩在线一区二区三区视频| 99国产精品久| 欧美精品一二三| 精品免费国产二区三区| 国产精品欧美一区喷水| 一区二区三区小说| 日韩成人av影视| 国产精品一区二区91| 91在线看国产| 欧美日韩一区不卡| 精品99一区二区| ...xxx性欧美| 午夜精品福利一区二区蜜股av| 秋霞电影网一区二区| 国产一区二区调教| 91免费精品国自产拍在线不卡| 欧美综合天天夜夜久久| 精品国产91亚洲一区二区三区婷婷| 国产香蕉久久精品综合网| 亚洲啪啪综合av一区二区三区| 亚洲国产精品一区二区www在线| 男人的天堂久久精品| 99精品久久只有精品| 日韩一级片网站| 亚洲视频网在线直播| 久久99久国产精品黄毛片色诱| 不卡的av网站| 欧美大白屁股肥臀xxxxxx| 国产精品久久福利| 免费成人av在线| 色妞www精品视频| 欧美videos大乳护士334| 亚洲天堂网中文字| 韩国女主播一区| 69久久99精品久久久久婷婷| 中文字幕成人在线观看| 蜜臀av一区二区| 欧洲精品视频在线观看| 欧美激情资源网| 久久国产成人午夜av影院| 色天天综合久久久久综合片| 久久久99精品免费观看| 日韩高清欧美激情| 91麻豆自制传媒国产之光| 久久久久免费观看| 毛片av一区二区| 欧美日韩国产123区| 亚洲精品成人悠悠色影视| 成人综合婷婷国产精品久久蜜臀| 日韩一区二区精品| 亚洲国产精品精华液网站| a美女胸又www黄视频久久| 欧美大胆一级视频| 蜜臀av一区二区在线免费观看 | 久久久亚洲高清| 久久se这里有精品| 337p亚洲精品色噜噜狠狠| 一区二区三区美女视频| 97久久超碰国产精品电影| 国产亚洲美州欧州综合国| 九色|91porny| 日韩精品一区二区在线| 免费观看一级欧美片| 欧美一区二区三区不卡| 午夜精品久久久久影视| 欧美色涩在线第一页| 亚洲一区二区三区四区五区黄| 91麻豆国产自产在线观看| 亚洲日本在线看| 色综合视频一区二区三区高清| 中文字幕在线免费不卡| av亚洲精华国产精华| 中文字幕一区二区三中文字幕 | 国产大陆a不卡|