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

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

?? xslt_processorimpl.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 "xslt_processorimpl.h"
#include "xsl_stylesheetimpl.h"
#include "html_documentimpl.h"
#include "loader.h"
#include "khtmlview.h"
#include "khtml_part.h"

#include <libxslt/xsltutils.h>
#include <libxslt/documents.h>
#include <libxslt/imports.h>

using namespace khtml;
using namespace DOM;

namespace DOM {
    
XSLTProcessorImpl::XSLTProcessorImpl(XSLStyleSheetImpl* sheet, DocumentImpl* source)
:m_stylesheet(sheet), m_sourceDocument(source)
{
    if (m_stylesheet)
        m_stylesheet->ref();
    if (m_sourceDocument)
        m_sourceDocument->ref();
}

XSLTProcessorImpl::~XSLTProcessorImpl()
{
    if (m_stylesheet)
        m_stylesheet->deref();
    if (m_sourceDocument)
        m_sourceDocument->deref();
}

static XSLStyleSheetImpl* globalSheet = 0;
static xmlDocPtr stylesheetLoadFunc(const xmlChar* uri,
                                    xmlDictPtr dict,
                                    int options,
                                    void* ctxt,
                                    xsltLoadType type)
{
    if (type != XSLT_LOAD_STYLESHEET)
        return NULL; // FIXME: Add support for XSLT_LOAD_DOCUMENT for the document() function.
    
    if (!globalSheet)
        return NULL;
    return globalSheet->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri);
}

DocumentImpl* XSLTProcessorImpl::transformDocument(DocumentImpl* doc)
{
    // FIXME: Right now we assume |doc| is unparsed, but if it has been parsed we will need to serialize it
    // and then feed that resulting source to libxslt.
    m_resultOutput = "";

    if (!m_stylesheet || !m_stylesheet->document()) return 0;
        
    globalSheet = m_stylesheet;
    xsltSetLoaderFunc(stylesheetLoadFunc);

    xsltStylesheetPtr sheet = m_stylesheet->compileStyleSheet();

    globalSheet = 0;
    xsltSetLoaderFunc(0);

    if (!sheet) return 0;
    m_stylesheet->clearDocuments();
  
    // Get the parsed source document.
    xmlDocPtr sourceDoc = (xmlDocPtr)doc->transformSource();
    xmlDocPtr resultDoc = xsltApplyStylesheet(sheet, sourceDoc, NULL);
    DocumentImpl* result = documentFromXMLDocPtr(resultDoc, sheet);
    xsltFreeStylesheet(sheet);
    return result;
}

static int bufferWrite(void* context, const char* buffer, int len)
{
    static_cast<XSLTProcessorImpl*>(context)->addToResult(buffer, len);
    return len;
}

void XSLTProcessorImpl::addToResult(const char* buffer, int len)
{
    m_resultOutput += QString(buffer, len);
}

DocumentImpl* XSLTProcessorImpl::documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet)
{
    // FIXME: For now we serialize and then reparse.  It might be more optimal to write a DOM
    // converter.
    if (!resultDoc || !sheet) return 0;
    DocumentImpl* result = 0;
    xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(NULL);
    if (outputBuf) {
        outputBuf->context = this;
        outputBuf->writecallback = bufferWrite;
        
        if (xsltSaveResultTo(outputBuf, resultDoc, sheet) < 0)
            return 0;
        
        // There are three types of output we need to be able to deal with:
        // HTML (create an HTML document), XML (create an XML document), and text (wrap in a <pre> and
        // make an XML document).
        KHTMLView* view = m_sourceDocument->view();
        const xmlChar* method;
        XSLT_GET_IMPORT_PTR(method, sheet, method);
        if (method == NULL && resultDoc->type == XML_HTML_DOCUMENT_NODE)
            method = (const xmlChar*)"html";
        if (xmlStrEqual(method, (const xmlChar*)"html"))
            result = m_sourceDocument->implementation()->createHTMLDocument(view);
        else
            result = m_sourceDocument->implementation()->createDocument(view);
        result->attach();
        result->setURL(m_sourceDocument->URL());
        result->setBaseURL(m_sourceDocument->baseURL());
        result->setDecoder(m_sourceDocument->decoder()); // FIXME: Should just be UTF-16.
        result->docLoader()->setShowAnimations(m_sourceDocument->docLoader()->showAnimations());
        result->setTransformSourceDocument(m_sourceDocument);

        if (xmlStrEqual(method, (const xmlChar*)"text")) {
            // Modify the output so that it is a well-formed XHTML document with a <pre> tag enclosing
            // the text.
            QString beforeString("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n<pre>\n<![CDATA[");
            QString afterString("]]>\n</pre>\n</body>\n</html>\n");
            m_resultOutput = beforeString + m_resultOutput + afterString;
        }
        
        // Before parsing, we need to detach the old document completely and get the new document
        // in place.  We have to do this only if we're rendering the result document.
        if (view) {
            view->clear();
            view->part()->replaceDocImpl(result);
        }
        
        result->open();
        result->determineParseMode(m_resultOutput); // Make sure we parse in the correct mode.
        result->write(m_resultOutput);
        result->finishParsing();
        if (view)
            view->part()->checkCompleted();
        else
            result->close(); // FIXME: Even viewless docs can load subresources. onload will fire too early.
                             // This is probably a bug in XMLHttpRequestObjects as well.
    }
    return result;
}

}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级专区免费大片| 欧美国产精品专区| 成人免费视频免费观看| 日韩精品欧美成人高清一区二区| 中文一区一区三区高中清不卡| 一区二区三区高清| 亚洲综合色网站| 亚洲午夜免费福利视频| 香蕉影视欧美成人| 美日韩一区二区| 精品一区二区日韩| 国产99久久久国产精品| 91论坛在线播放| 欧美日韩精品福利| 69精品人人人人| 精品盗摄一区二区三区| 精品国产91乱码一区二区三区 | 日韩高清不卡在线| 青青草原综合久久大伊人精品 | 性久久久久久久久久久久| 99久久综合国产精品| 在线免费不卡视频| 欧美一二区视频| 久久久不卡影院| 国产精品二三区| 亚洲制服欧美中文字幕中文字幕| 成人免费观看av| 国产日产欧美一区二区视频| 艳妇臀荡乳欲伦亚洲一区| 成人av高清在线| 欧美一卡在线观看| 欧美a级一区二区| 欧美一级爆毛片| 精品一二三四在线| 久久久精品黄色| 成人avav在线| 亚洲日韩欧美一区二区在线| 奇米综合一区二区三区精品视频| 在线播放91灌醉迷j高跟美女| 久久网站最新地址| 午夜精品久久久久久久久| 大胆亚洲人体视频| 国产精品素人视频| 毛片不卡一区二区| 精品久久久久久久人人人人传媒| 亚洲欧美精品午睡沙发| 国产精品一二三四五| 欧美伊人久久大香线蕉综合69 | 欧美福利一区二区| 蜜桃视频第一区免费观看| 欧美一级搡bbbb搡bbbb| 国产一区二区三区四区五区入口 | 亚洲高清不卡在线| 日韩欧美你懂的| 香蕉成人伊视频在线观看| 欧美一级二级三级乱码| 国产高清亚洲一区| 精品国产一区二区亚洲人成毛片| 国产美女视频一区| 樱花影视一区二区| 91在线视频免费观看| 中文一区一区三区高中清不卡| 色婷婷亚洲精品| 国产精品美女久久久久久久久| 色一区在线观看| 激情综合色综合久久| 一区二区在线电影| 欧美精品一区男女天堂| 99视频在线精品| 麻豆精品一区二区| 亚洲男人天堂av| 精品福利一二区| 欧洲亚洲精品在线| 精品无人码麻豆乱码1区2区 | 欧美乱妇15p| 国产成人av电影在线| 亚洲一区视频在线| 国产香蕉久久精品综合网| 国内精品免费**视频| 欧美精品一区二区三区蜜臀| 色综合中文综合网| 日本免费新一区视频| 亚洲欧美日韩精品久久久久| 日韩视频免费观看高清完整版在线观看 | 麻豆久久久久久久| 伊人开心综合网| 国产欧美日韩综合| 欧美一级二级在线观看| 在线观看免费成人| fc2成人免费人成在线观看播放| 免费成人在线影院| 香蕉久久夜色精品国产使用方法| 中文字幕一区二区日韩精品绯色| 在线亚洲人成电影网站色www| 亚洲国产成人高清精品| 国产欧美久久久精品影院| 日韩欧美高清在线| 7777精品伊人久久久大香线蕉经典版下载| 成人av网址在线| 成人一区二区在线观看| 麻豆精品一区二区三区| 日本色综合中文字幕| 亚洲电影在线播放| 一区二区三区四区在线免费观看| 国产精品无遮挡| 国产精品麻豆欧美日韩ww| 国产日韩精品视频一区| 欧美激情中文字幕| 久久久www免费人成精品| 欧美成人在线直播| 精品久久久久一区二区国产| 精品蜜桃在线看| 久久久久国产精品麻豆| 久久噜噜亚洲综合| 欧美精彩视频一区二区三区| 国产欧美一区二区精品秋霞影院| 久久久久久久综合狠狠综合| 国产欧美一区二区精品秋霞影院 | 99久久免费国产| 91色综合久久久久婷婷| 一本高清dvd不卡在线观看| 97成人超碰视| 欧美视频一区二区三区| 欧美一区二区免费视频| 日韩欧美成人一区| 久久久亚洲国产美女国产盗摄 | 日韩精品一区二区三区在线观看| 欧美一级二级三级蜜桃| 久久亚洲春色中文字幕久久久| 国产亚洲欧美在线| 亚洲欧美偷拍卡通变态| 亚洲v日本v欧美v久久精品| 免费一级片91| 国产河南妇女毛片精品久久久| av电影在线不卡| 欧美日韩极品在线观看一区| 日韩午夜激情av| 欧美国产日韩在线观看| 亚洲一区在线看| 精品一区二区在线视频| 成人美女在线观看| 欧美主播一区二区三区| 精品国产一二三| 亚洲乱码国产乱码精品精可以看| 日韩国产精品久久久久久亚洲| 国产精品888| 在线观看欧美日本| 久久久久久久综合狠狠综合| 亚洲欧洲精品一区二区精品久久久| 视频精品一区二区| 成人免费视频app| 欧美欧美午夜aⅴ在线观看| 国产亚洲精品中文字幕| 亚洲高清三级视频| 国产成人在线视频免费播放| 欧美亚洲高清一区二区三区不卡| 精品裸体舞一区二区三区| 一区二区三区在线免费播放| 国产主播一区二区| 欧美性生活久久| 欧美国产日韩在线观看| 另类小说图片综合网| 日韩高清不卡一区二区三区| 成人一区二区三区视频在线观看| 555www色欧美视频| 亚洲人精品一区| 国产精品正在播放| 3atv在线一区二区三区| 亚洲男人的天堂一区二区| 国产毛片精品一区| 日韩一区二区三区免费看 | 久久精品国产第一区二区三区| 色综合久久88色综合天天6| 欧美精品一区二区三区蜜桃视频| 一区二区免费视频| 99久久99精品久久久久久| 国产亚洲va综合人人澡精品| 日韩精品电影在线| 欧美日韩欧美一区二区| 91精品国产综合久久久久久| 亚洲欧美日韩国产成人精品影院| 国产成人免费视频精品含羞草妖精| 91精品国产综合久久蜜臀| 一区二区三区在线观看欧美| 波多野结衣中文字幕一区二区三区| 欧美精品一区二区三区蜜臀 | 99久久国产综合精品色伊| 久久久精品tv| 国产精品自拍av| 国产亚洲欧美一级| 国产成人在线电影| 久久精品日产第一区二区三区高清版| 日本 国产 欧美色综合| 91精品国产欧美一区二区 | 亚洲黄色性网站| 色8久久人人97超碰香蕉987| 亚洲欧美日韩国产手机在线| 日本久久一区二区| 亚洲激情在线播放| 欧美性生交片4|