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

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

?? xsl_stylesheetimpl.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
字號:
/**
 * This file is part of the XSL implementation.
 *
 * 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.
 */

#ifdef KHTML_XSLT

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

#include "xml/dom_nodeimpl.h"
#include "html/html_documentimpl.h"
#include "misc/loader.h"
#include "xsl_stylesheetimpl.h"

#include <kdebug.h>

#include <libxslt/xsltutils.h>
#include <libxml/uri.h>

#define IS_BLANK_NODE(n)                                                \
    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))

using namespace khtml;
using namespace DOM;

namespace DOM {
    
XSLStyleSheetImpl::XSLStyleSheetImpl(XSLImportRuleImpl *parentRule, DOMString href)
    : StyleSheetImpl(parentRule, href)
{
    m_lstChildren = new QPtrList<StyleBaseImpl>;
    m_ownerDocument = 0;
    m_processed = false; // Child sheets get marked as processed when the libxslt engine has finally seen them.
}

XSLStyleSheetImpl::XSLStyleSheetImpl(NodeImpl *parentNode, DOMString href,  bool embedded)
    : StyleSheetImpl(parentNode, href)
{
    m_lstChildren = new QPtrList<StyleBaseImpl>;
    m_ownerDocument = parentNode->getDocument();
    m_embedded = embedded;
    m_processed = true; // The root sheet starts off processed.
}

XSLStyleSheetImpl::~XSLStyleSheetImpl()
{
    if (!m_embedded)
        xmlFreeDoc(m_stylesheetDoc);
}

bool XSLStyleSheetImpl::isLoading()
{
    for (StyleBaseImpl* rule = m_lstChildren->first(); rule; rule = m_lstChildren->next()) {
        if (rule->isImportRule()) {
            XSLImportRuleImpl* import = static_cast<XSLImportRuleImpl*>(rule);
            if (import->isLoading())
                return true;
        }
    }
    return false;
}

void XSLStyleSheetImpl::checkLoaded()
{
    if (isLoading()) 
        return;
    if (m_parent)
        m_parent->checkLoaded();
    if (m_parentNode)
        m_parentNode->sheetLoaded();
}

void XSLStyleSheetImpl::clearDocuments()
{
    m_stylesheetDoc = 0;
    for (StyleBaseImpl* rule = m_lstChildren->first(); rule; rule = m_lstChildren->next()) {
        if (rule->isImportRule()) {
            XSLImportRuleImpl* import = static_cast<XSLImportRuleImpl*>(rule);
            if (import->styleSheet())
                import->styleSheet()->clearDocuments();
        }
    }
}

khtml::DocLoader* XSLStyleSheetImpl::docLoader()
{
    if (!m_ownerDocument)
        return 0;
    return m_ownerDocument->docLoader();
}

bool XSLStyleSheetImpl::parseString(const DOMString &string, bool strict)
{
    // Parse in a single chunk into an xmlDocPtr
    const QChar BOM(0xFEFF);
    const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char *>(&BOM);
    m_stylesheetDoc = xmlReadMemory(reinterpret_cast<const char *>(string.unicode()),
                                    string.length() * sizeof(QChar),
                                    m_ownerDocument->URL().ascii(),
                                    BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", 
                                    XML_PARSE_NOCDATA|XML_PARSE_DTDATTR|XML_PARSE_NOENT);
    loadChildSheets();
    return m_stylesheetDoc;
}

void XSLStyleSheetImpl::loadChildSheets()
{
    if (!m_stylesheetDoc)
        return;
    
    xmlNodePtr stylesheetRoot = m_stylesheetDoc->children;
    if (m_embedded) {
        // We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the 
        // import/include list.
        xmlAttrPtr idNode = xmlGetID(m_stylesheetDoc, (const xmlChar*)(const char*)(href().string().utf8()));
        if (idNode == NULL)
            return;
        stylesheetRoot = idNode->parent;
    } else {
        // FIXME: Need to handle an external URI with a # in it.  This is a pretty minor edge case, so we'll deal
        // with it later.
    }
    
    if (stylesheetRoot) {
        // Walk the children of the root element and look for import/include elements.
        // Imports must occur first.
        xmlNodePtr curr = stylesheetRoot->children;
        while (curr) {
            if (IS_BLANK_NODE(curr)) {
                curr = curr->next;
                continue;
            }
            if (IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "import")) {
                xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar *)"href", XSLT_NAMESPACE);
                QString buff = QString::fromUtf8((const char*)uriRef);
                loadChildSheet(buff);
            } else
                break;
            curr = curr->next;
        }

        // Now handle includes.
        while (curr) {
            if (IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "include")) {
                xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar *)"href", XSLT_NAMESPACE);
                QString buff = QString::fromUtf8((const char*)uriRef);
                loadChildSheet(buff);
            }
            curr = curr->next;
        }
    }
}

void XSLStyleSheetImpl::loadChildSheet(const QString& href)
{
    XSLImportRuleImpl* childRule = new XSLImportRuleImpl(this, href);
    m_lstChildren->append(childRule);
    childRule->loadSheet();
}

XSLStyleSheetImpl* XSLImportRuleImpl::parentStyleSheet() const
{
    return (m_parent && m_parent->isXSLStyleSheet()) ? static_cast<XSLStyleSheetImpl*>(m_parent) : 0;
}

xsltStylesheetPtr XSLStyleSheetImpl::compileStyleSheet()
{
    // FIXME: Hook up error reporting for the stylesheet compilation process.
    if (m_embedded)
        return xsltLoadStylesheetPI(m_stylesheetDoc);
    else
        return xsltParseStylesheetDoc(m_stylesheetDoc);
}

xmlDocPtr XSLStyleSheetImpl::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri)
{
    bool matchedParent = (parentDoc == m_stylesheetDoc);
    for (StyleBaseImpl* rule = m_lstChildren->first(); rule; rule = m_lstChildren->next()) {
        if (rule->isImportRule()) {
            XSLImportRuleImpl* import = static_cast<XSLImportRuleImpl*>(rule);
            XSLStyleSheetImpl* child = import->styleSheet();
            if (!child) continue;
            if (matchedParent) {
                if (child->processed()) continue; // libxslt has been given this sheet already.
                
                // Check the URI of the child stylesheet against the doc URI.
                // In order to ensure that libxml canonicalized both URLs, we get the original href
                // string from the import rule and canonicalize it using libxml before comparing it
                // with the URI argument.
                QCString importHref = import->href().string().utf8();
                xmlChar* base = xmlNodeGetBase(parentDoc, (xmlNodePtr)parentDoc);
                xmlChar* childURI = xmlBuildURI((const xmlChar*)(const char*)importHref, base);
                if (xmlStrEqual(uri, childURI)) {
                    child->markAsProcessed();
                    return child->document();
                }
            }
            else {
                xmlDocPtr result = import->styleSheet()->locateStylesheetSubResource(parentDoc, uri);
                if (result)
                    return result;
            }
        }
    }
    
    return NULL;
}

// ----------------------------------------------------------------------------------------------

XSLImportRuleImpl::XSLImportRuleImpl(StyleBaseImpl* parent, const DOMString &href)
: StyleBaseImpl(parent)
{
    m_strHref = href;
    m_styleSheet = 0;
    m_cachedSheet = 0;
    m_loading = false;
}

XSLImportRuleImpl::~XSLImportRuleImpl()
{
    if (m_styleSheet) {
        m_styleSheet->setParent(0);
        m_styleSheet->deref();
    }
    
    if (m_cachedSheet)
        m_cachedSheet->deref(this);
}

void XSLImportRuleImpl::setStyleSheet(const DOMString& url, const DOMString& sheet)
{
    if (m_styleSheet) {
        m_styleSheet->setParent(0);
        m_styleSheet->deref();
    }
    m_styleSheet = new XSLStyleSheetImpl(this, url);
    m_styleSheet->ref();
    
    XSLStyleSheetImpl* parent = parentStyleSheet();
    if (parent)
        m_styleSheet->setOwnerDocument(parent->ownerDocument());

    m_styleSheet->parseString(sheet);
    m_loading = false;
    
    checkLoaded();
}

bool XSLImportRuleImpl::isLoading()
{
    return (m_loading || (m_styleSheet && m_styleSheet->isLoading()));
}

void XSLImportRuleImpl::loadSheet()
{
    DocLoader* docLoader = 0;
    StyleBaseImpl* root = this;
    StyleBaseImpl* parent;
    while ((parent = root->parent()))
	root = parent;
    if (root->isXSLStyleSheet())
	docLoader = static_cast<XSLStyleSheetImpl*>(root)->docLoader();
    
    DOMString absHref = m_strHref;
    XSLStyleSheetImpl* parentSheet = parentStyleSheet();
    if (!parentSheet->href().isNull())
        // use parent styleheet's URL as the base URL
        absHref = KURL(parentSheet->href().string(),m_strHref.string()).url();
    
    // Check for a cycle in our import chain.  If we encounter a stylesheet
    // in our parent chain with the same URL, then just bail.
    for (parent = static_cast<StyleBaseImpl*>(this)->parent(); parent; parent = parent->parent())
        if (absHref == parent->baseURL())
            return;
    
    m_cachedSheet = docLoader->requestXSLStyleSheet(absHref);
    
    if (m_cachedSheet) {
        m_cachedSheet->ref(this);
        
        // If the imported sheet is in the cache, then setStyleSheet gets called,
        // and the sheet even gets parsed (via parseString).  In this case we have
        // loaded (even if our subresources haven't), so if we have a stylesheet after
        // checking the cache, then we've clearly loaded.
        if (!m_styleSheet)
            m_loading = true;
    }
}

}
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美年轻男男videosbes| 男女激情视频一区| 色猫猫国产区一区二在线视频| 国产日韩av一区| 91麻豆蜜桃一区二区三区| 亚洲欧美激情一区二区| 欧美视频一区二区三区在线观看| 午夜精品久久久久久久久久| 日韩丝袜情趣美女图片| 国产成人夜色高潮福利影视| 国产精品乱子久久久久| 色哟哟精品一区| 日韩综合小视频| 国产色婷婷亚洲99精品小说| 色哟哟一区二区三区| 蜜桃视频在线一区| 国产精品免费视频网站| 欧美性感一类影片在线播放| 日本va欧美va欧美va精品| 欧美经典一区二区三区| 欧美日韩一区二区三区四区| 极品少妇一区二区三区精品视频 | 高清av一区二区| 中文字幕在线不卡视频| 制服丝袜av成人在线看| 丰满白嫩尤物一区二区| 午夜欧美大尺度福利影院在线看| 久久久综合精品| 欧美亚州韩日在线看免费版国语版| 青椒成人免费视频| 亚洲欧美一区二区三区极速播放 | 一道本成人在线| 久久99蜜桃精品| 亚洲另类在线视频| 久久久久久电影| 884aa四虎影成人精品一区| 岛国精品在线播放| 免费久久99精品国产| 最新中文字幕一区二区三区| 日韩欧美色电影| 欧美视频一区在线观看| 丁香亚洲综合激情啪啪综合| 日韩av中文字幕一区二区| 亚洲欧美日韩国产综合| 日韩免费电影一区| 欧美视频你懂的| 波多野结衣91| 国产伦精品一区二区三区在线观看| 亚洲影院久久精品| 国产精品污网站| 久久综合久久鬼色中文字| 在线电影欧美成精品| 91丨九色丨蝌蚪富婆spa| 国产福利91精品一区二区三区| 男人的天堂亚洲一区| 另类专区欧美蜜桃臀第一页| 自拍偷拍亚洲欧美日韩| 国产三级一区二区| 久久一区二区三区四区| 精品美女被调教视频大全网站| 欧美裸体bbwbbwbbw| 欧洲另类一二三四区| 91色在线porny| 99精品国产热久久91蜜凸| 国产成人精品免费网站| 国产精品一区二区黑丝| 国产乱码精品一区二区三区忘忧草| 免费在线一区观看| 免费观看日韩电影| 蜜臀精品一区二区三区在线观看 | 国产精品欧美久久久久一区二区| 精品国产乱码久久久久久蜜臀| 在线不卡a资源高清| 91免费视频网址| 91色porny蝌蚪| 97久久超碰国产精品| 色综合咪咪久久| 在线免费av一区| 欧美三级电影在线看| 91精品福利在线| 欧美色男人天堂| 7777精品伊人久久久大香线蕉经典版下载 | 欧美日韩一区成人| 欧美日韩不卡一区| 欧美一级片在线| 日韩欧美一区二区三区在线| 精品国产伦理网| 久久久久高清精品| 成人欧美一区二区三区在线播放| 亚洲人快播电影网| 亚洲成人免费电影| 久久丁香综合五月国产三级网站| 国产伦精品一区二区三区在线观看| 国产999精品久久| av影院午夜一区| 欧美视频一区二区三区四区| 欧美一卡二卡在线| 欧美韩日一区二区三区| 亚洲欧美日韩中文播放| 日韩高清一级片| 国产精品一区免费在线观看| 99这里只有久久精品视频| 欧美午夜精品免费| 欧美电视剧在线看免费| 国产精品色婷婷久久58| 亚洲成人你懂的| 国产九九视频一区二区三区| 91在线一区二区| 欧美一级免费大片| 国产精品久久久久久久久免费丝袜 | 日韩高清欧美激情| 国产盗摄精品一区二区三区在线| 91色视频在线| 亚洲精品一区二区三区福利| 日韩毛片一二三区| 精品在线观看免费| 91网站最新地址| www激情久久| 性久久久久久久| 国产成人av在线影院| 欧美无人高清视频在线观看| 精品国产乱码91久久久久久网站| 亚洲色图制服丝袜| 国产伦精品一区二区三区在线观看| 色悠久久久久综合欧美99| 精品99一区二区三区| 一卡二卡三卡日韩欧美| 国产一区欧美一区| 69堂国产成人免费视频| 亚洲男女毛片无遮挡| 国产一区二区三区| 欧美日韩一区国产| 成人免费小视频| 国产寡妇亲子伦一区二区| 欧美卡1卡2卡| 亚洲乱码国产乱码精品精的特点| 国产在线精品国自产拍免费| 欧美日韩中文一区| 亚洲素人一区二区| 国产成a人亚洲| 精品久久国产字幕高潮| 日韩国产在线观看| 欧美色偷偷大香| 中文字幕字幕中文在线中不卡视频| 国产精品自产自拍| 欧美一区二区三区免费在线看 | 中文无字幕一区二区三区| 久久国产尿小便嘘嘘尿| 777久久久精品| 三级成人在线视频| 欧美日韩在线三级| 亚洲欧美一区二区三区孕妇| 成人在线视频一区二区| 26uuu欧美| 激情欧美日韩一区二区| 日韩欧美一区电影| 免费在线观看不卡| 日韩免费一区二区| 蜜臀精品一区二区三区在线观看| 欧美日韩1234| 偷拍自拍另类欧美| 91精品久久久久久蜜臀| 午夜av电影一区| 欧美精品在线一区二区| 亚洲国产一区二区在线播放| 欧美午夜精品久久久久久超碰| 一区二区久久久| 欧美色视频在线| 手机精品视频在线观看| 宅男在线国产精品| 日韩激情视频在线观看| 91精品黄色片免费大全| 美女一区二区在线观看| 精品区一区二区| 国产成人av资源| 18成人在线视频| 欧美三级三级三级爽爽爽| 天天色天天爱天天射综合| 在线播放中文一区| 久久99久国产精品黄毛片色诱| 欧美精品一区二区三区高清aⅴ | 欧美精品精品一区| 久久av中文字幕片| 亚洲一区二区三区自拍| 欧美精品久久99| 国内欧美视频一区二区| 国产精品久久一级| 欧美日韩视频在线第一区| 奇米一区二区三区| 国产日韩精品一区二区浪潮av| av电影天堂一区二区在线| 亚洲一区二区三区四区中文字幕| 3d动漫精品啪啪1区2区免费| 极品少妇一区二区| 国产精品福利一区| 欧美猛男超大videosgay| 蜜臀av一区二区三区| 欧美高清在线一区二区| 欧美日韩在线播放三区四区| 黄色资源网久久资源365|