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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? css_valueimpl.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/**
 * This file is part of the DOM implementation for KDE.
 *
 * (C) 1999-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.
 */

#include "dom/css_value.h"
#include "dom/dom_exception.h"
#include "dom/dom_string.h"

#include "css/css_valueimpl.h"
#include "css/css_ruleimpl.h"
#include "css/css_stylesheetimpl.h"
#include "css/cssparser.h"
#include "css/cssproperties.h"
#include "css/cssvalues.h"
#include "css/cssstyleselector.h"

#include "xml/dom_stringimpl.h"
#include "xml/dom_docimpl.h"
#include "html/html_elementimpl.h"

#include "misc/loader.h"

#include "rendering/font.h"
#include "rendering/render_style.h"

#include <kdebug.h>
#include <qregexp.h>
#include <qpaintdevice.h>
#include <qpaintdevicemetrics.h>

// Hack for debugging purposes
extern DOM::DOMString getPropertyName(unsigned short id);

using khtml::FontDef;
using khtml::CSSStyleSelector;

namespace DOM {

#if 0

// Too risky to quote all legal identifiers right now.
// Post-Tiger we should use this function or something like it.

// Return true if this string qualifies as an identifier (from the point of view of CSS syntax).
static bool isLegalIdentifier(const DOMString &string)
{
    int len = string.length();
    if (len == 0) {
        return false;
    }
    QChar *p = string.unicode();
    int i = 0;
    if (p[0] == '-') {
        ++i;
    }
    if (i == len) {
        return false;
    }
    ushort code = p[i].unicode();
    if (!(code >= 0x80 || code == '_' || isalpha(code))) {
        return false;
    }
    ++i;
    while (i != len) {
        code = p[i].unicode();
        if (!(code >= 0x80 || code == '-' || code == '_' || isalnum(code))) {
            return false;
        }
        ++i;
    }
    return true;
}

#endif

// Quotes the string if it needs quoting.
// We use single quotes for now beause markup.cpp uses double quotes.
static DOMString quoteStringIfNeeded(const DOMString &string)
{
    // For now, just do this for strings that start with "#" to fix Korean font names that start with "#".
    // Post-Tiger, we should isLegalIdentifier instead after working out all the ancillary issues.
    if (string[0] != '#') {
        return string;
    }

    // FIXME: Also need to transform control characters into \ sequences.
    QString s = string.string();
    s.replace('\\', "\\\\");
    s.replace('\'', "\\'");
    return '\'' + s + '\'';
}

CSSStyleDeclarationImpl::CSSStyleDeclarationImpl(CSSRuleImpl *parent)
    : StyleBaseImpl(parent)
{
}

bool CSSStyleDeclarationImpl::isStyleDeclaration()
{
    return true;
}

CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl()
    : m_node(0)
{
}

CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl(CSSRuleImpl *parent)
    : CSSStyleDeclarationImpl(parent), m_node(0)
{
}

CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl(CSSRuleImpl *parent, const QValueList<CSSProperty> &values)
    : CSSStyleDeclarationImpl(parent), m_values(values), m_node(0)
{
    // FIXME: This allows duplicate properties.
}

CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl(CSSRuleImpl *parent, const CSSProperty * const *properties, int numProperties)
    : CSSStyleDeclarationImpl(parent), m_node(0)
{
    for (int i = 0; i < numProperties; ++i)
        m_values.append(*properties[i]);
    // FIXME: This allows duplicate properties.
}

CSSMutableStyleDeclarationImpl& CSSMutableStyleDeclarationImpl::operator=(const CSSMutableStyleDeclarationImpl& o)
{
    // don't attach it to the same node, just leave the current m_node value
    m_values = o.m_values;
    return *this;
}

CSSMutableStyleDeclarationImpl::~CSSMutableStyleDeclarationImpl()
{
    // we don't use refcounting for m_node, to avoid cyclic references (see ElementImpl)
}

DOMString CSSMutableStyleDeclarationImpl::getPropertyValue( int propertyID ) const
{
    CSSValueImpl* value = getPropertyCSSValue( propertyID );
    if (value)
        return CSSValue(value).cssText();

    // Shorthand and 4-values properties
    switch ( propertyID ) {
    case CSS_PROP_BACKGROUND_POSITION:
    {
        // ## Is this correct? The code in cssparser.cpp is confusing
        const int properties[2] = { CSS_PROP_BACKGROUND_POSITION_X,
                                    CSS_PROP_BACKGROUND_POSITION_Y };
        return getShortHandValue( properties, 2 );
    }
    case CSS_PROP_BACKGROUND:
    {
        const int properties[5] = { CSS_PROP_BACKGROUND_IMAGE, CSS_PROP_BACKGROUND_REPEAT,
                                    CSS_PROP_BACKGROUND_ATTACHMENT, CSS_PROP_BACKGROUND_POSITION,
                                    CSS_PROP_BACKGROUND_COLOR };
        return getShortHandValue( properties, 5 );
    }
    case CSS_PROP_BORDER:
    {
        const int properties[3] = { CSS_PROP_BORDER_WIDTH, CSS_PROP_BORDER_STYLE,
                                    CSS_PROP_BORDER_COLOR };
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_BORDER_TOP:
    {
        const int properties[3] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_TOP_STYLE,
                                    CSS_PROP_BORDER_TOP_COLOR};
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_BORDER_RIGHT:
    {
        const int properties[3] = { CSS_PROP_BORDER_RIGHT_WIDTH, CSS_PROP_BORDER_RIGHT_STYLE,
                                    CSS_PROP_BORDER_RIGHT_COLOR};
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_BORDER_BOTTOM:
    {
        const int properties[3] = { CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_BOTTOM_STYLE,
                                    CSS_PROP_BORDER_BOTTOM_COLOR};
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_BORDER_LEFT:
    {
        const int properties[3] = { CSS_PROP_BORDER_LEFT_WIDTH, CSS_PROP_BORDER_LEFT_STYLE,
                                    CSS_PROP_BORDER_LEFT_COLOR};
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_OUTLINE:
    {
        const int properties[3] = { CSS_PROP_OUTLINE_WIDTH, CSS_PROP_OUTLINE_STYLE,
                                    CSS_PROP_OUTLINE_COLOR };
        return getShortHandValue( properties, 3 );
    }
    case CSS_PROP_BORDER_COLOR:
    {
        const int properties[4] = { CSS_PROP_BORDER_TOP_COLOR, CSS_PROP_BORDER_RIGHT_COLOR,
                                    CSS_PROP_BORDER_BOTTOM_COLOR, CSS_PROP_BORDER_LEFT_COLOR };
        return get4Values( properties );
    }
    case CSS_PROP_BORDER_WIDTH:
    {
        const int properties[4] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_RIGHT_WIDTH,
                                    CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_LEFT_WIDTH };
        return get4Values( properties );
    }
    case CSS_PROP_BORDER_STYLE:
    {
        const int properties[4] = { CSS_PROP_BORDER_TOP_STYLE, CSS_PROP_BORDER_RIGHT_STYLE,
                                    CSS_PROP_BORDER_BOTTOM_STYLE, CSS_PROP_BORDER_LEFT_STYLE };
        return get4Values( properties );
    }
    case CSS_PROP_MARGIN:
    {
        const int properties[4] = { CSS_PROP_MARGIN_TOP, CSS_PROP_MARGIN_RIGHT,
                                    CSS_PROP_MARGIN_BOTTOM, CSS_PROP_MARGIN_LEFT };
        return get4Values( properties );
    }
    case CSS_PROP_PADDING:
    {
        const int properties[4] = { CSS_PROP_PADDING_TOP, CSS_PROP_PADDING_RIGHT,
                                    CSS_PROP_PADDING_BOTTOM, CSS_PROP_PADDING_LEFT };
        return get4Values( properties );
    }
    case CSS_PROP_LIST_STYLE:
    {
        const int properties[3] = { CSS_PROP_LIST_STYLE_TYPE, CSS_PROP_LIST_STYLE_POSITION,
                                    CSS_PROP_LIST_STYLE_IMAGE };
        return getShortHandValue( properties, 3 );
    }
    }
    //kdDebug() << k_funcinfo << "property not found:" << propertyID << endl;
    return DOMString();
}

DOMString CSSMutableStyleDeclarationImpl::get4Values( const int* properties ) const
{
    DOMString res;
    for ( int i = 0 ; i < 4 ; ++i ) {
        CSSValueImpl* value = getPropertyCSSValue( properties[i] );
        if ( !value ) { // apparently all 4 properties must be specified.
            return DOMString();
        }
        value->ref();
        if ( i > 0 )
            res += " ";
        res += value->cssText();
        value->deref();
    }
    return res;
}

DOMString CSSMutableStyleDeclarationImpl::getShortHandValue( const int* properties, int number ) const
{
    DOMString res;
    for ( int i = 0 ; i < number ; ++i ) {
        CSSValueImpl* value = getPropertyCSSValue( properties[i] );
        if ( value ) { // TODO provide default value if !value
            value->ref();
            if ( !res.isNull() )
                res += " ";
            res += value->cssText();
            value->deref();
        }
    }
    return res;
}

 CSSValueImpl *CSSMutableStyleDeclarationImpl::getPropertyCSSValue( int propertyID ) const
{
    QValueListConstIterator<CSSProperty> end;
    for (QValueListConstIterator<CSSProperty> it = m_values.fromLast(); it != end; --it)
        if (propertyID == (*it).m_id)
            return (*it).value();
    return 0;
}

DOMString CSSMutableStyleDeclarationImpl::removeProperty(int propertyID, bool notifyChanged, int &exceptionCode)
{
    if (m_node && !m_node->getDocument())
        return ""; // FIXME: This (not well-understood) situation happens on albertsons.com.  We don't really know how they managed to run a script on a node
                   // with no document pointer, but this sidesteps the crash.

    exceptionCode = 0;

    DOMString value;

    QValueListIterator<CSSProperty> end;
    for (QValueListIterator<CSSProperty> it = m_values.fromLast(); it != end; --it)
        if (propertyID == (*it).m_id) {
            value = (*it).value()->cssText();
            m_values.remove(it);
            if (notifyChanged)
                setChanged();
            break;
        }

    return value;
}

void CSSMutableStyleDeclarationImpl::clear()
{
    m_values.clear();
    setChanged();
}

void CSSMutableStyleDeclarationImpl::setChanged()
{
    if (m_node) {
        m_node->setChanged();
        // FIXME: Ideally, this should be factored better and there
        // should be a subclass of CSSMutableStyleDeclarationImpl just
        // for inline style declarations that handles this
        if (m_node->isHTMLElement() && this == static_cast<HTMLElementImpl *>(m_node)->inlineStyleDecl())
            static_cast<HTMLElementImpl *>(m_node)->invalidateStyleAttribute();
        return;
    }

    // ### quick&dirty hack for KDE 3.0... make this MUCH better! (Dirk)
    for (StyleBaseImpl* stylesheet = this; stylesheet; stylesheet = stylesheet->parent())
        if (stylesheet->isCSSStyleSheet()) {
            static_cast<CSSStyleSheetImpl*>(stylesheet)->doc()->updateStyleSelector();
            break;
        }
}

bool CSSMutableStyleDeclarationImpl::getPropertyPriority(int propertyID) const
{
    QValueListConstIterator<CSSProperty> end;
    for (QValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it)
        if (propertyID == (*it).m_id)
            return (*it).m_bImportant;
    return false;
}

void CSSMutableStyleDeclarationImpl::setProperty(int propertyID, const DOMString &value, bool important, int &exceptionCode)
{
    setProperty(propertyID, value, important, true, exceptionCode);
}

DOMString CSSMutableStyleDeclarationImpl::removeProperty(int propertyID, int &exceptionCode)
{
    return removeProperty(propertyID, true, exceptionCode);
}

bool CSSMutableStyleDeclarationImpl::setProperty(int propertyID, const DOMString &value, bool important, bool notifyChanged, int &exceptionCode)
{
    if (m_node && !m_node->getDocument())
        return false; // FIXME: This (not well-understood) situation happens on albertsons.com.  We don't really know how they managed to run a script on a node
                      // with no document pointer, but this sidesteps the crash.
    exceptionCode = 0;

    removeProperty(propertyID);

    CSSParser parser(strictParsing);
    bool success = parser.parseValue(this, propertyID, value, important);
    if (!success) {
#if !APPLE_CHANGES
	kdDebug( 6080 ) << "CSSMutableStyleDeclarationImpl::setProperty invalid property: [" << getPropertyName(id).string()
			<< "] value: [" << value.string() << "]"<< endl;
#endif
        exceptionCode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
    } else if (notifyChanged)
        setChanged();
    return success;
}

bool CSSMutableStyleDeclarationImpl::setProperty(int propertyID, int value, bool important, bool notifyChanged)
{
    removeProperty(propertyID);
    m_values.append(CSSProperty(propertyID, new CSSPrimitiveValueImpl(value), important));
    if (notifyChanged)
        setChanged();
    return true;
}

void CSSMutableStyleDeclarationImpl::setStringProperty(int propertyId, const DOMString &value, CSSPrimitiveValue::UnitTypes type, bool important)
{
    removeProperty(propertyId);
    m_values.append(CSSProperty(propertyId, new CSSPrimitiveValueImpl(value, type), important));
    setChanged();
}

void CSSMutableStyleDeclarationImpl::setImageProperty(int propertyId, const DOMString &URL, bool important)
{
    removeProperty(propertyId);
    m_values.append(CSSProperty(propertyId, new CSSImageValueImpl(URL, this), important));
    setChanged();
}

void CSSMutableStyleDeclarationImpl::parseDeclaration(const DOMString &styleDeclaration)
{
    m_values.clear();
    CSSParser parser(strictParsing);
    parser.parseDeclaration(this, styleDeclaration);
    setChanged();
}

void CSSMutableStyleDeclarationImpl::addParsedProperties(const CSSProperty * const *properties, int numProperties)
{
    for (int i = 0; i < numProperties; ++i) {
        removeProperty(properties[i]->id(), false);
        m_values.append(*properties[i]);
    }
    // FIXME: This probably should have a call to setChanged() if something changed. We may also wish to add
    // a notifyChanged argument to this function to follow the model of other functions in this class.
}

void CSSMutableStyleDeclarationImpl::setLengthProperty(int id, const DOM::DOMString &value, bool important, bool _multiLength )
{
    bool parseMode = strictParsing;
    strictParsing = false;
    multiLength = _multiLength;
    setProperty( id, value, important);
    strictParsing = parseMode;
    multiLength = false;
}

unsigned long CSSMutableStyleDeclarationImpl::length() const
{
    return m_values.count();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线不卡a资源高清| 久久精品日韩一区二区三区| 黄色日韩三级电影| 一区二区三区在线影院| 2020国产精品| 欧美精品久久久久久久多人混战| 懂色一区二区三区免费观看| 日韩中文欧美在线| 亚洲精品视频在线观看免费| 久久久久久久久久久久久女国产乱| 色婷婷综合在线| 国产成人综合网站| 日本女优在线视频一区二区| 悠悠色在线精品| 国产精品视频yy9299一区| 精品免费日韩av| 欧美日韩国产成人在线免费| 99久久久国产精品| 国产91精品入口| 国模娜娜一区二区三区| 视频一区视频二区中文| 夜夜精品视频一区二区| 综合欧美一区二区三区| 欧美精彩视频一区二区三区| 精品国产91乱码一区二区三区| 在线成人小视频| 91久久精品一区二区三| 91免费看`日韩一区二区| 成人综合婷婷国产精品久久| 韩国女主播成人在线| 青草av.久久免费一区| 午夜伊人狠狠久久| 亚洲超碰精品一区二区| 一区二区三区欧美日| 亚洲视频在线一区观看| 国产精品乱人伦| 久久久久国产成人精品亚洲午夜| 精品国产一区a| 精品国产凹凸成av人导航| 精品美女在线观看| 久久夜色精品一区| 精品国产欧美一区二区| 久久品道一品道久久精品| 欧美成人一级视频| 久久久久9999亚洲精品| 国产亚洲午夜高清国产拍精品| 久久精品免费在线观看| 中文字幕不卡在线| 综合网在线视频| 最新热久久免费视频| 一级精品视频在线观看宜春院| 亚洲伊人伊色伊影伊综合网| 亚洲曰韩产成在线| 五月开心婷婷久久| 蜜桃久久久久久| 国产酒店精品激情| 成人午夜av影视| 91蜜桃网址入口| 欧美日韩高清一区二区三区| 欧美一区二区三区不卡| 久久久精品综合| 亚洲视频狠狠干| 亚洲成人资源在线| 经典三级一区二区| 成人h动漫精品一区二区| 在线视频亚洲一区| 日韩三级电影网址| 国产精品欧美久久久久无广告| 亚洲免费在线视频| 午夜激情综合网| 国产精品99久久不卡二区| 99久久国产免费看| 91精品国产91热久久久做人人| 久久久www成人免费无遮挡大片| 国产精品嫩草影院com| 亚洲综合一区在线| 久久av资源网| 91亚洲精品久久久蜜桃网站| 欧美精品久久99久久在免费线 | 欧美系列一区二区| 精品国产91久久久久久久妲己| 亚洲欧美在线高清| 麻豆成人久久精品二区三区小说| 成人综合在线观看| 欧美精品三级在线观看| 中文字幕乱码一区二区免费| 亚洲国产精品影院| 国产jizzjizz一区二区| 欧美日韩激情一区二区| 国产亚洲一区二区三区| 亚洲成av人片www| 不卡av电影在线播放| 欧美一个色资源| 亚洲视频中文字幕| 国产一区91精品张津瑜| 欧美日韩在线亚洲一区蜜芽| 久久久精品一品道一区| 日日摸夜夜添夜夜添亚洲女人| 国产白丝网站精品污在线入口| 欧美军同video69gay| 中文字幕一区二区三区视频| 久久成人免费日本黄色| 欧美亚洲一区三区| 国产精品久久久99| 国产精品一区二区三区乱码| 欧美日韩日本视频| 亚洲欧美一区二区久久| 岛国一区二区三区| 精品国产伦一区二区三区观看方式| 亚洲在线视频网站| 91亚洲国产成人精品一区二区三 | 久久嫩草精品久久久精品| 一区二区三区美女| 成人av资源在线| 国产欧美精品一区二区色综合朱莉| 免费欧美在线视频| 在线播放91灌醉迷j高跟美女| 日韩理论片网站| 成人教育av在线| 国产清纯白嫩初高生在线观看91 | 91在线观看成人| 日本一区二区视频在线观看| 精品亚洲porn| 欧美r级电影在线观看| 欧美aaa在线| 欧美高清视频一二三区 | 国产欧美日韩精品a在线观看| 久久99在线观看| 日韩一二三区视频| 日韩中文字幕不卡| 91麻豆精品久久久久蜜臀| 午夜不卡av在线| 欧美日韩一区二区三区在线 | 一区二区高清免费观看影视大全| 99视频在线精品| 亚洲三级视频在线观看| 99re这里都是精品| 亚洲人成小说网站色在线 | 亚洲综合色婷婷| 91福利视频在线| 亚洲va韩国va欧美va| 亚洲人成网站色在线观看| 99精品桃花视频在线观看| 亚洲免费观看在线观看| 欧美性猛交xxxxxxxx| 亚洲一区二区三区影院| 欧美日韩一区二区在线视频| 天堂在线亚洲视频| 日韩一二三四区| 国产成人福利片| 亚洲欧美日韩系列| 欧美日韩一区二区三区在线看 | 美腿丝袜一区二区三区| 欧美mv日韩mv| 成人午夜在线播放| 尤物在线观看一区| 欧美一区二区三区四区高清| 久久国产精品一区二区| 久久久国产午夜精品| 91网页版在线| 亚洲va欧美va国产va天堂影院| 日韩一级免费一区| 国产乱色国产精品免费视频| 国产精品第一页第二页第三页| 欧美亚洲一区二区在线| 精品一区二区三区在线播放视频| 久久―日本道色综合久久| 91浏览器入口在线观看| 人禽交欧美网站| 中文字幕av资源一区| 精品视频一区 二区 三区| 精品一二线国产| 亚洲天堂av老司机| 日韩午夜小视频| 波多野结衣亚洲| 三级久久三级久久久| 国产欧美一区二区精品忘忧草| 色哟哟在线观看一区二区三区| 日韩中文字幕91| 国产三级精品视频| 欧美丝袜丝nylons| 国产91对白在线观看九色| 一区二区三区四区乱视频| 亚洲精品一区二区三区蜜桃下载 | 国产成人亚洲综合a∨婷婷图片| 亚洲六月丁香色婷婷综合久久 | 亚洲激情第一区| 日韩欧美一区中文| 色成年激情久久综合| 久久精品国产99久久6| 一区二区三区国产| 久久精品一二三| 欧美久久婷婷综合色| av在线播放成人| 久久99久久99| 亚洲国产成人高清精品| 亚洲国产精华液网站w| 欧美电影免费观看高清完整版在| 色爱区综合激月婷婷| 成人国产亚洲欧美成人综合网|