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

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

?? visible_text.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
 * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

#include "visible_text.h"

#include "misc/htmltags.h"
#include "rendering/render_text.h"
#include "xml/dom_nodeimpl.h"
#include "xml/dom_position.h"
#include "xml/dom2_rangeimpl.h"

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

using DOM::DOMString;
using DOM::Node;
using DOM::NodeImpl;
using DOM::offsetInCharacters;
using DOM::Range;
using DOM::RangeImpl;

// FIXME: These classes should probably use the render tree and not the DOM tree, since elements could
// be hidden using CSS, or additional generated content could be added.  For now, we just make sure
// text objects walk their renderers' InlineTextBox objects, so that we at least get the whitespace 
// stripped out properly and obey CSS visibility for text runs.

namespace khtml {

const unsigned short nonBreakingSpace = 0xA0;

// Buffer that knows how to compare with a search target.
// Keeps enough of the previous text to be able to search in the future,
// but no more.
class CircularSearchBuffer 
OOM_MODIFIED
{
public:
    CircularSearchBuffer(const QString &target, bool isCaseSensitive);
    ~CircularSearchBuffer() { free(m_buffer); }

    void clear() { m_cursor = m_buffer; m_bufferFull = false; }
    void append(long length, const QChar *characters);
    void append(const QChar &);

    long neededCharacters() const;
    bool isMatch() const;
    long length() const { return m_target.length(); }

private:
    QString m_target;
    bool m_isCaseSensitive;

    QChar *m_buffer;
    QChar *m_cursor;
    bool m_bufferFull;

    CircularSearchBuffer(const CircularSearchBuffer&);
    CircularSearchBuffer &operator=(const CircularSearchBuffer&);
};

TextIterator::TextIterator() : m_endContainer(0), m_endOffset(0), m_positionNode(0)
{
}

TextIterator::TextIterator(const Range &r, IteratorKind kind) : m_endContainer(0), m_endOffset(0), m_positionNode(0)
{
    const RangeImpl *ri = r.handle();
    if (!ri)
        return;

    int exceptionCode = 0;

    // get and validate the range endpoints
    NodeImpl *startContainer = ri->startContainer(exceptionCode);
    long startOffset = ri->startOffset(exceptionCode);
    NodeImpl *endContainer = ri->endContainer(exceptionCode);
    long endOffset = ri->endOffset(exceptionCode);
    if (exceptionCode != 0)
        return;

    // remember ending place - this does not change
    m_endContainer = endContainer;
    m_endOffset = endOffset;

    // set up the current node for processing
    m_node = ri->startNode();
    if (m_node == 0)
        return;
    m_offset = m_node == startContainer ? startOffset : 0;
    m_handledNode = false;
    m_handledChildren = false;

    // calculate first out of bounds node
    m_pastEndNode = ri->pastEndNode();

    // initialize node processing state
    m_needAnotherNewline = false;
    m_textBox = 0;

    // initialize record of previous node processing
    m_lastTextNode = 0;
    m_lastTextNodeEndedWithCollapsedSpace = false;
    if (kind == RUNFINDER)
        m_lastCharacter = 0;
    else
        m_lastCharacter = '\n';

#ifndef NDEBUG
    // need this just because of the assert in advance()
    m_positionNode = m_node;
#endif

    // identify the first run
    advance();
}

void TextIterator::advance()
{
    // otherwise, where are we advancing from?
    assert(m_positionNode);

    // reset the run information
    m_positionNode = 0;
    m_textLength = 0;

    // handle remembered node that needed a newline after the text node's newline
    if (m_needAnotherNewline) {
        // emit the newline, with position a collapsed range at the end of current node.
        emitCharacter('\n', m_node->parentNode(), m_node, 1, 1);
        m_needAnotherNewline = false;
        return;
    }

    // handle remembered text box
    if (m_textBox) {
        handleTextBox();
        if (m_positionNode) {
            return;
        }
    }

    while (m_node && m_node != m_pastEndNode) {
        // handle current node according to its type
        if (!m_handledNode) {
            RenderObject *renderer = m_node->renderer();
            if (renderer && renderer->isText() && m_node->nodeType() == Node::TEXT_NODE) {
                // FIXME: What about CDATA_SECTION_NODE?
                if (renderer->style()->visibility() == VISIBLE) {
                    m_handledNode = handleTextNode();
                }
            } else if (renderer && (renderer->isImage() || renderer->isWidget())) {
                if (renderer->style()->visibility() == VISIBLE) {
                    m_handledNode = handleReplacedElement();
                }
            } else {
                m_handledNode = handleNonTextNode();
            }
            if (m_positionNode) {
                return;
            }
        }

        // find a new current node to handle in depth-first manner,
        // calling exitNode() as we come back thru a parent node
        NodeImpl *next = m_handledChildren ? 0 : m_node->firstChild();
        m_offset = 0;
        if (!next) {
            next = m_node->nextSibling();
            if (!next) {
                if (m_node->traverseNextNode() == m_pastEndNode)
                    break;
                while (!next && m_node->parentNode()) {
                    m_node = m_node->parentNode();
                    exitNode();
                    if (m_positionNode) {
                        m_handledNode = true;
                        m_handledChildren = true;
                        return;
                    }
                    next = m_node->nextSibling();
                }
            }
        }

        // set the new current node
        m_node = next;
        m_handledNode = false;
        m_handledChildren = false;

        // how would this ever be?
        if (m_positionNode) {
            return;
        }
    }
}

bool TextIterator::handleTextNode()
{
    m_lastTextNode = m_node;

    RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
    DOMString str = m_node->nodeValue();

    // handle pre-formatted text
    if (renderer->style()->whiteSpace() == khtml::PRE) {
        long runStart = m_offset;
        if (m_lastTextNodeEndedWithCollapsedSpace) {
            emitCharacter(' ', m_node, 0, runStart, runStart);
            return false;
        }
        long strLength = str.length();
        long end = (m_node == m_endContainer) ? m_endOffset : LONG_MAX;
        long runEnd = kMin(strLength, end);

        m_positionNode = m_node;
        m_positionOffsetBaseNode = 0;
        m_positionStartOffset = runStart;
        m_positionEndOffset = runEnd;
        m_textCharacters = str.unicode() + runStart;
        m_textLength = runEnd - runStart;

        m_lastCharacter = str[runEnd - 1];

        return true;
    }

    if (!renderer->firstTextBox() && str.length() > 0) {
        m_lastTextNodeEndedWithCollapsedSpace = true; // entire block is collapsed space
        return true;
    }

    m_textBox = renderer->firstTextBox();
    handleTextBox();
    return true;
}

void TextIterator::handleTextBox()
{    
    RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
    DOMString str = m_node->nodeValue();
    long start = m_offset;
    long end = (m_node == m_endContainer) ? m_endOffset : LONG_MAX;
    for (; m_textBox; m_textBox = m_textBox->nextTextBox()) {
        long textBoxStart = m_textBox->m_start;
        long runStart = kMax(textBoxStart, start);

        // Check for collapsed space at the start of this run.
        bool needSpace = m_lastTextNodeEndedWithCollapsedSpace
            || (m_textBox == renderer->firstTextBox() && textBoxStart == runStart && runStart > 0);
        if (needSpace && !isCollapsibleWhitespace(m_lastCharacter) && !m_lastCharacter.isNull()) {
            emitCharacter(' ', m_node, 0, runStart, runStart);
            return;
        }
        long textBoxEnd = textBoxStart + m_textBox->m_len;
        long runEnd = kMin(textBoxEnd, end);

        if (runStart < runEnd) {
            // Handle either a single newline character (which becomes a space),
            // or a run of characters that does not include a newline.
            // This effectively translates newlines to spaces without copying the text.
            if (str[runStart] == '\n') {
                emitCharacter(' ', m_node, 0, runStart, runStart + 1);
                m_offset = runStart + 1;
            } else {
                long subrunEnd = str.find('\n', runStart);
                if (subrunEnd == -1 || subrunEnd > runEnd) {
                    subrunEnd = runEnd;
                }

                m_offset = subrunEnd;

                m_positionNode = m_node;
                m_positionOffsetBaseNode = 0;
                m_positionStartOffset = runStart;
                m_positionEndOffset = subrunEnd;
                m_textCharacters = str.unicode() + runStart;
                m_textLength = subrunEnd - runStart;

                m_lastTextNodeEndedWithCollapsedSpace = false;
                m_lastCharacter = str[subrunEnd - 1];
            }

            // If we are doing a subrun that doesn't go to the end of the text box,
            // come back again to finish handling this text box; don't advance to the next one.
            if (m_positionEndOffset < textBoxEnd) {
                return;
            }

            // Advance to the next text box.
            InlineTextBox *nextTextBox = m_textBox->nextTextBox();
            long nextRunStart = nextTextBox ? nextTextBox->m_start : str.length();
            if (nextRunStart > runEnd) {
                m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
            }
            m_textBox = nextTextBox;
            return;
        }
    }
}

bool TextIterator::handleReplacedElement()
{
    if (m_lastTextNodeEndedWithCollapsedSpace) {
        emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1);
        return false;
    }

    m_positionNode = m_node->parentNode();
    m_positionOffsetBaseNode = m_node;
    m_positionStartOffset = 0;
    m_positionEndOffset = 1;

    m_textCharacters = 0;
    m_textLength = 0;

    m_lastCharacter = 0;

    return true;
}

bool TextIterator::handleNonTextNode()
{
    switch (m_node->id()) {
        case ID_BR: {
            emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
            break;
        }

        case ID_TD:
        case ID_TH:
            if (m_lastCharacter != '\n' && m_lastTextNode) {
                emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
            }
            break;

        case ID_BLOCKQUOTE:
        case ID_DD:
        case ID_DIV:
        case ID_DL:
        case ID_DT:
        case ID_H1:
        case ID_H2:
        case ID_H3:
        case ID_H4:
        case ID_H5:
        case ID_H6:
        case ID_HR:
        case ID_LI:
        case ID_OL:
        case ID_P:
        case ID_PRE:

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久久久久久久久久久包黑料| 亚洲午夜在线视频| 久久久精品一品道一区| 日韩免费性生活视频播放| 91精品国产综合久久精品性色| 欧美性猛交xxxxxx富婆| 欧美亚洲国产一区在线观看网站 | 国产成人8x视频一区二区| 久久精品国产一区二区三| 男女激情视频一区| 黄色日韩三级电影| 国产大片一区二区| 成人福利视频网站| hitomi一区二区三区精品| 91丨porny丨蝌蚪视频| 色哟哟精品一区| 欧美影院一区二区三区| 欧美羞羞免费网站| 777久久久精品| 亚洲精品一区二区三区福利| 久久久精品国产免费观看同学| 久久精品免视看| 亚洲免费观看在线观看| 亚洲国产精品视频| 久久av中文字幕片| 国产福利一区二区三区视频| 99热这里都是精品| 欧美日韩一卡二卡| 欧美成人vps| 国产精品久久久久久亚洲伦 | 日韩精品一区在线| 国产亚洲综合性久久久影院| 亚洲色图.com| 五月婷婷久久丁香| 国产在线国偷精品产拍免费yy | 中文av一区特黄| 一二三区精品视频| 精油按摩中文字幕久久| 成人国产精品免费观看| 欧美日韩国产系列| 久久久久久**毛片大全| 亚洲激情五月婷婷| 精品一区二区三区久久| av一本久道久久综合久久鬼色| 欧美日韩免费视频| 久久婷婷成人综合色| 亚洲免费观看高清完整版在线观看熊| 午夜伊人狠狠久久| 国产成人啪免费观看软件| 91国偷自产一区二区三区成为亚洲经典| 91精品蜜臀在线一区尤物| 欧美高清一级片在线观看| 天天综合色天天综合色h| 国产激情91久久精品导航| 91福利在线免费观看| 精品乱人伦一区二区三区| 一区二区三区四区不卡在线| 精品无人区卡一卡二卡三乱码免费卡 | 亚洲特黄一级片| 捆绑紧缚一区二区三区视频| 久久综合九色综合欧美98| 亚洲免费色视频| 国产在线播精品第三| 欧美少妇bbb| 国产精品人妖ts系列视频| 日本美女一区二区| 91蜜桃免费观看视频| 久久综合九色综合97婷婷女人| 亚洲成a天堂v人片| 91美女在线观看| 国产视频一区二区在线观看| 蜜臀av性久久久久av蜜臀妖精| 色婷婷综合中文久久一本| 国产视频一区在线观看| 毛片一区二区三区| 欧美日韩精品欧美日韩精品一综合 | 国产精品久久一级| 免费在线一区观看| 在线看国产一区| 亚洲色图另类专区| 成人免费视频视频| 久久久噜噜噜久噜久久综合| 久色婷婷小香蕉久久| 欧美精品丝袜久久久中文字幕| 亚洲欧美成aⅴ人在线观看| 风间由美一区二区三区在线观看| 日韩欧美激情在线| 免费看欧美美女黄的网站| 欧美午夜不卡视频| 一区二区在线观看免费视频播放| 丁香一区二区三区| 欧美高清在线视频| 成人丝袜高跟foot| 亚洲国产经典视频| 精品第一国产综合精品aⅴ| 视频在线观看一区二区三区| 日本道免费精品一区二区三区| 欧美激情在线一区二区三区| 国产美女av一区二区三区| 精品国产欧美一区二区| 麻豆精品一区二区av白丝在线| 日本大香伊一区二区三区| 亚洲乱码国产乱码精品精小说| gogogo免费视频观看亚洲一| 国产精品久线在线观看| 不卡一区在线观看| 亚洲欧洲日韩女同| 91老师国产黑色丝袜在线| 亚洲精品视频观看| 欧美日韩免费一区二区三区视频| 亚洲国产成人av网| 欧美一区二区久久久| 精品一区二区影视| 国产欧美日韩另类视频免费观看| 国产美女精品人人做人人爽| 亚洲国产精品激情在线观看 | 国产拍揄自揄精品视频麻豆| 国产成人亚洲综合a∨婷婷| 国产日本欧洲亚洲| 9久草视频在线视频精品| 一区二区高清免费观看影视大全 | 亚洲国产精品成人久久综合一区 | 精品国产乱码久久久久久久| 国产在线一区观看| 中文字幕不卡在线播放| 色婷婷精品久久二区二区蜜臀av | 日韩福利视频导航| 久久综合五月天婷婷伊人| 国产成人无遮挡在线视频| 国产精品灌醉下药二区| 欧美天堂亚洲电影院在线播放| 蜜桃久久久久久久| 欧美激情在线观看视频免费| 日本韩国欧美国产| 麻豆精品在线播放| 国产精品麻豆视频| 欧美日韩在线亚洲一区蜜芽| 久久国产乱子精品免费女| 日本一区二区三区四区在线视频 | 欧美一区二区三区男人的天堂 | 欧美电影免费观看完整版| 成人午夜视频福利| 一区二区三区中文字幕精品精品| 91麻豆精品国产91久久久久久 | 欧美一区二区三区免费大片| 国产一区二区精品久久99| 国产精品乱人伦一区二区| 91福利区一区二区三区| 久久狠狠亚洲综合| 亚洲视频一区在线| 日韩欧美在线网站| 成年人网站91| 久久国产三级精品| 亚洲美女在线一区| 久久青草国产手机看片福利盒子| av动漫一区二区| 久久成人av少妇免费| 亚洲嫩草精品久久| 欧美不卡视频一区| 91麻豆国产在线观看| 国产一区二区在线免费观看| 亚洲综合自拍偷拍| 国产人成亚洲第一网站在线播放 | 91免费观看视频| 久久成人18免费观看| 一区二区三区欧美久久| 久久久五月婷婷| 欧美日韩高清在线播放| 北条麻妃国产九九精品视频| 蜜桃精品视频在线| 亚洲一区二区三区美女| 国产精品狼人久久影院观看方式| 日韩视频免费观看高清完整版在线观看| 99国产精品国产精品久久| 精品一区二区日韩| 五月激情综合网| 一区二区三区欧美激情| 国产精品污www在线观看| 26uuu色噜噜精品一区二区| 欧美日韩激情一区二区三区| 99精品视频一区| 丁香天五香天堂综合| 捆绑紧缚一区二区三区视频| 亚洲亚洲精品在线观看| 中文字幕一区二区日韩精品绯色| 精品黑人一区二区三区久久| 欧美美女网站色| 欧美亚洲动漫制服丝袜| 91亚洲国产成人精品一区二区三| 国产精品一二二区| 国产在线国偷精品免费看| 日本少妇一区二区| 亚洲国产精品麻豆| 一区二区三区日韩欧美精品 | 国精产品一区一区三区mba视频 | 亚洲一区二区影院| 国产精品久久久久婷婷 | 国产一区二区三区观看| 美女视频第一区二区三区免费观看网站| 亚洲成人激情av|