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

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

?? render_form.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/*
 * This file is part of the DOM implementation for KDE.
 *
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
 *           (C) 2000 Dirk Mueller (mueller@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 <kdebug.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kcompletionbox.h>
#include <kcursor.h>

#include <qstyle.h>

#include "misc/helper.h"
#include "xml/dom2_eventsimpl.h"
#include "html/html_formimpl.h"
#include "misc/htmlhashes.h"

#include "rendering/render_form.h"
#include "rendering/render_canvas.h"
#include <assert.h>

#include "khtmlview.h"
#include "khtml_ext.h"
#include "xml/dom_docimpl.h"



#include <kdebug.h>

#if APPLE_CHANGES
#include "KWQFileButton.h"
#include "KWQSlider.h"
#endif

using namespace khtml;
using namespace DOM;

RenderFormElement::RenderFormElement(HTMLGenericFormElementImpl *element)
    : RenderWidget(element)
{
    setInline(true);
}

RenderFormElement::~RenderFormElement()
{
}

short RenderFormElement::baselinePosition( bool f, bool isRootLineBox ) const
{
#if APPLE_CHANGES
    return marginTop() + widget()->baselinePosition(m_height);
#else
    return RenderWidget::baselinePosition( f, isRootLineBox ) - 2 - style()->fontMetrics().descent();
#endif
}

#ifdef NOKIA_CHANGES
int RenderFormElement::calcReplacedWidth() const
{
    int zoom(canvas()->view()->scalingFactor());
    int width = RenderBox::calcReplacedWidth();
    int bidiWidth = canvas()->view()->maxBidiWidth();

    Length w = style()->width();
    if( w.type == Fixed) {
      width = width*100/zoom;
    }
    // form should not exceed the view width
    width = width>bidiWidth?bidiWidth:width;
    return width;
}
#endif

void RenderFormElement::setStyle(RenderStyle* s)
{
#if APPLE_CHANGES
    if (canHaveIntrinsicMargins())
        addIntrinsicMarginsIfAllowed(s);
#endif

    RenderWidget::setStyle(s);

#if APPLE_CHANGES && !NOKIA_CHANGES
    // Do not paint a background or border for Aqua form elements
    setShouldPaintBackgroundOrBorder(false);
#endif

    m_widget->setFont(style()->font());
}

void RenderFormElement::updateFromElement()
{
    m_widget->setEnabled(!element()->disabled());

#if APPLE_CHANGES
    m_widget->setPalette(QPalette(style()->backgroundColor(), style()->color()));
#else
    QColor color = style()->color();
    QColor backgroundColor = style()->backgroundColor();

    if ( color.isValid() || backgroundColor.isValid() ) {
        QPalette pal(m_widget->palette());

        int contrast_ = KGlobalSettings::contrast();
        int highlightVal = 100 + (2*contrast_+4)*16/10;
        int lowlightVal = 100 + (2*contrast_+4)*10;

        if (backgroundColor.isValid()) {
	    for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Background, backgroundColor );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Light, backgroundColor.light(highlightVal) );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Dark, backgroundColor.dark(lowlightVal) );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Mid, backgroundColor.dark(120) );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Midlight, backgroundColor.light(110) );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Button, backgroundColor );
		pal.setColor( (QPalette::ColorGroup)i, QColorGroup::Base, backgroundColor );
	    }
        }
        if ( color.isValid() ) {
	    struct ColorSet {
		QPalette::ColorGroup cg;
		QColorGroup::ColorRole cr;
	    };
	    const struct ColorSet toSet [] = {
		{ QPalette::Active, QColorGroup::Foreground },
		{ QPalette::Active, QColorGroup::ButtonText },
		{ QPalette::Active, QColorGroup::Text },
		{ QPalette::Inactive, QColorGroup::Foreground },
		{ QPalette::Inactive, QColorGroup::ButtonText },
		{ QPalette::Inactive, QColorGroup::Text },
		{ QPalette::Disabled,QColorGroup::ButtonText },
		{ QPalette::NColorGroups, QColorGroup::NColorRoles },
	    };
	    const ColorSet *set = toSet;
	    while( set->cg != QPalette::NColorGroups ) {
		pal.setColor( set->cg, set->cr, color );
		++set;
	    }

            QColor disfg = color;
            int h, s, v;
            disfg.hsv( &h, &s, &v );
            if (v > 128)
                // dark bg, light fg - need a darker disabled fg
                disfg = disfg.dark(lowlightVal);
            else if (disfg != Qt::black)
                // light bg, dark fg - need a lighter disabled fg - but only if !black
                disfg = disfg.light(highlightVal);
            else
                // black fg - use darkgrey disabled fg
                disfg = Qt::darkGray;
            pal.setColor(QPalette::Disabled,QColorGroup::Foreground,disfg);
        }

        m_widget->setPalette(pal);
    }
    else
        m_widget->unsetPalette();
#endif
}

void RenderFormElement::layout()
{
    KHTMLAssert( needsLayout() );
    KHTMLAssert( minMaxKnown() );

    // minimum height
    m_height = 0;

    calcWidth();
    calcHeight();

#if !APPLE_CHANGES
    if ( m_widget )
        resizeWidget(m_widget,
                     m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
                     m_height-borderLeft()-borderRight()-paddingLeft()-paddingRight());
#endif

    setNeedsLayout(false);
}

void RenderFormElement::slotClicked()
{
    // FIXME: Should share code with KHTMLView::dispatchMouseEvent, which does a lot of the same stuff.

    RenderArena *arena = ref();

#if APPLE_CHANGES
    QMouseEvent event(QEvent::MouseButtonRelease); // gets "current event"
    element()->dispatchMouseEvent(&event, EventImpl::CLICK_EVENT, event.clickCount());
#else
    // We also send the KHTML_CLICK or KHTML_DBLCLICK event for
    // CLICK. This is not part of the DOM specs, but is used for
    // compatibility with the traditional onclick="" and ondblclick=""
    // attributes, as there is no way to tell the difference between
    // single & double clicks using DOM (only the click count is
    // stored, which is not necessarily the same)

    QMouseEvent e2(QEvent::MouseButtonRelease, m_mousePos, m_button, m_state);
    element()->dispatchMouseEvent(&e2, EventImpl::CLICK_EVENT, m_clickCount);
    element()->dispatchMouseEvent(&e2, m_isDoubleClick ? EventImpl::KHTML_DBLCLICK_EVENT : EventImpl::KHTML_CLICK_EVENT, m_clickCount);
#endif

    deref(arena);
}

Qt::AlignmentFlags RenderFormElement::textAlignment() const
{
    switch (style()->textAlign()) {
        case LEFT:
        case KHTML_LEFT:
            return AlignLeft;
        case RIGHT:
        case KHTML_RIGHT:
            return AlignRight;
        case CENTER:
        case KHTML_CENTER:
            return AlignHCenter;
        case JUSTIFY:
            // Just fall into the auto code for justify.
        case TAAUTO:
            return style()->direction() == RTL ? AlignRight : AlignLeft;
    }
    assert(false); // Should never be reached.
    return AlignLeft;
}

#if APPLE_CHANGES

void RenderFormElement::addIntrinsicMarginsIfAllowed(RenderStyle* _style)
{
    // Cut out the intrinsic margins completely if we end up using mini controls.
    if (_style->font().pixelSize() < 11)
        return;

    int m = intrinsicMargin();
    if (_style->width().isVariable()) {
        if (_style->marginLeft().quirk)
            _style->setMarginLeft(Length(m, Fixed));
        if (_style->marginRight().quirk)
            _style->setMarginRight(Length(m, Fixed));
    }

    if (_style->height().isVariable()) {
        if (_style->marginTop().quirk)
            _style->setMarginTop(Length(m, Fixed));
        if (_style->marginBottom().quirk)
            _style->setMarginBottom(Length(m, Fixed));
    }
}

#endif

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

RenderButton::RenderButton(HTMLGenericFormElementImpl *element)
    : RenderFormElement(element)
{
}

short RenderButton::baselinePosition( bool f, bool isRootLineBox ) const
{
#if APPLE_CHANGES
    return RenderFormElement::baselinePosition( f, isRootLineBox );
#else
    return RenderWidget::baselinePosition( f, isRootLineBox ) - 2;
#endif
}

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

RenderCheckBox::RenderCheckBox(HTMLInputElementImpl *element)
    : RenderButton(element)
{
    QCheckBox* b = new QCheckBox(view()->viewport());
    b->setAutoMask(true);
    b->setMouseTracking(true);
    setQWidget(b);
    connect(b,SIGNAL(stateChanged(int)),this,SLOT(slotStateChanged(int)));
    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
}

void RenderCheckBox::calcMinMaxWidth()
{
    KHTMLAssert( !minMaxKnown() );

#if APPLE_CHANGES
    // Let the widget tell us how big it wants to be.
    QSize s(widget()->sizeHint());
#else
    QCheckBox *cb = static_cast<QCheckBox *>( m_widget );
    QSize s( cb->style().pixelMetric( QStyle::PM_IndicatorWidth ),
             cb->style().pixelMetric( QStyle::PM_IndicatorHeight ) );
#endif
    setIntrinsicWidth( s.width() );
    setIntrinsicHeight( s.height() );

    RenderButton::calcMinMaxWidth();
}

void RenderCheckBox::updateFromElement()
{
    widget()->setChecked(element()->checked());

    RenderButton::updateFromElement();
}

// From the Qt documentation:
// state is 2 if the button is on, 1 if it is in the "no change" state or 0 if the button is off.
void RenderCheckBox::slotStateChanged(int state)
{
    element()->setChecked(state == 2);
    element()->onChange();
}

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

RenderRadioButton::RenderRadioButton(HTMLInputElementImpl *element)
    : RenderButton(element)
{
    QRadioButton* b = new QRadioButton(view()->viewport());
    b->setAutoMask(true);
    b->setMouseTracking(true);
    setQWidget(b);
    connect(b, SIGNAL(clicked()), this, SLOT(slotClicked()));
}

void RenderRadioButton::updateFromElement()
{
    widget()->setChecked(element()->checked());

    RenderButton::updateFromElement();
}

void RenderRadioButton::slotClicked()
{
    element()->setChecked(true);

    // emit mouseClick event etc
    RenderButton::slotClicked();
}

void RenderRadioButton::calcMinMaxWidth()
{
    KHTMLAssert( !minMaxKnown() );

#if APPLE_CHANGES
    // Let the widget tell us how big it wants to be.
    QSize s(widget()->sizeHint());
#else
    QRadioButton *rb = static_cast<QRadioButton *>( m_widget );
    QSize s( rb->style().pixelMetric( QStyle::PM_ExclusiveIndicatorWidth ),
             rb->style().pixelMetric( QStyle::PM_ExclusiveIndicatorHeight ) );
#endif
    setIntrinsicWidth( s.width() );
    setIntrinsicHeight( s.height() );

    RenderButton::calcMinMaxWidth();
}

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

RenderSubmitButton::RenderSubmitButton(HTMLInputElementImpl *element)
    : RenderButton(element)
{
    QPushButton* p = new QPushButton(view()->viewport());
    setQWidget(p);
    p->setAutoMask(true);
    p->setMouseTracking(true);
    connect(p, SIGNAL(clicked()), this, SLOT(slotClicked()));
}

QString RenderSubmitButton::rawText()
{
    QString value = element()->valueWithDefault().string();
    value = value.stripWhiteSpace();
    value.replace(QChar('\\'), backslashAsCurrencySymbol());
#if APPLE_CHANGES
    return value;
#else
    QString raw;
    for(unsigned int i = 0; i < value.length(); i++) {
        raw += value[i];
        if(value[i] == '&')
            raw += '&';
    }
    return raw;
#endif
}

void RenderSubmitButton::calcMinMaxWidth()
{
    KHTMLAssert( !minMaxKnown() );

#if APPLE_CHANGES
    // Let the widget tell us how big it wants to be.
    QSize s(widget()->sizeHint());
    setIntrinsicWidth(s.width());
    setIntrinsicHeight(s.height());
#else
    QString raw = rawText();
    QPushButton* pb = static_cast<QPushButton*>(m_widget);
    pb->setText(raw);
    pb->setFont(style()->font());

    bool empty = raw.isEmpty();
    if ( empty )
        raw = QString::fromLatin1("XXXX");
    QFontMetrics fm = pb->fontMetrics();
    int margin = pb->style().pixelMetric( QStyle::PM_ButtonMargin, pb);
    QSize s(pb->style().sizeFromContents(
                QStyle::CT_PushButton, pb, fm.size( ShowPrefix, raw))
            .expandedTo(QApplication::globalStrut()));

    setIntrinsicWidth( s.width() - margin / 2 );
    setIntrinsicHeight( s.height() - margin / 2);
#endif

    RenderButton::calcMinMaxWidth();
}

#if APPLE_CHANGES

void RenderSubmitButton::setStyle(RenderStyle *s)
{
    RenderButton::setStyle(s);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费观看在线综合| 免费高清视频精品| 久久精品人人做| 日韩免费电影一区| 日韩欧美激情在线| 91精品国产91久久久久久最新毛片 | 成人免费观看男女羞羞视频| 麻豆国产精品一区二区三区| 麻豆专区一区二区三区四区五区| 日韩精品国产欧美| 美日韩一区二区| 国产伦精一区二区三区| 国产精品456| eeuss鲁片一区二区三区在线观看| 成人免费视频一区二区| 不卡视频免费播放| 在线视频你懂得一区二区三区| 欧美系列一区二区| 91精品国产综合久久久蜜臀粉嫩| 日韩视频永久免费| 国产三级一区二区三区| 亚洲欧美综合网| 亚洲福利一二三区| 激情综合网最新| 99久久夜色精品国产网站| 日本韩国欧美在线| 精品国产网站在线观看| 国产精品视频第一区| 亚洲一卡二卡三卡四卡| 伦理电影国产精品| 97精品久久久午夜一区二区三区| 欧美精品 日韩| 欧美国产成人在线| 亚洲图片欧美视频| 国产精品99久久久久久有的能看| 99精品国产热久久91蜜凸| 91精品在线免费| 中文字幕一区二区三区在线不卡| 天堂一区二区在线免费观看| 国产激情精品久久久第一区二区| 欧美在线看片a免费观看| 久久人人超碰精品| 亚洲一区二区视频在线| 国产精品一区二区三区网站| 色综合久久88色综合天天 | 精品欧美一区二区久久| 亚洲天堂精品视频| 麻豆91小视频| 欧洲一区二区三区在线| 国产亚洲va综合人人澡精品| 亚洲午夜激情网页| 99久久精品一区| 国产亚洲成aⅴ人片在线观看| 亚洲第四色夜色| 成人福利电影精品一区二区在线观看| 在线综合视频播放| 亚洲日本在线视频观看| 国产伦精品一区二区三区在线观看| 日本高清视频一区二区| 国产精品视频看| 激情图区综合网| 欧美一级精品在线| 午夜国产精品影院在线观看| 豆国产96在线|亚洲| 久久综合资源网| 日本不卡免费在线视频| 日本高清无吗v一区| 一区视频在线播放| 99久久精品国产精品久久| 国产色综合一区| 韩国三级电影一区二区| 精品国免费一区二区三区| 奇米在线7777在线精品| 日韩午夜三级在线| 美女脱光内衣内裤视频久久网站| 欧美日韩和欧美的一区二区| 夜夜嗨av一区二区三区| 91蝌蚪porny成人天涯| 国产精品色哟哟| 成人精品鲁一区一区二区| 国产欧美一区二区三区鸳鸯浴 | 亚洲va国产va欧美va观看| 欧美性受xxxx黑人xyx性爽| 亚洲男人都懂的| 色香蕉成人二区免费| 国产精品成人免费在线| 99精品视频中文字幕| 一区二区三区四区在线播放| 欧美中文字幕一区二区三区亚洲| 亚洲在线视频网站| 欧美三区在线观看| 蜜臀久久99精品久久久画质超高清 | 国产人成亚洲第一网站在线播放| 国产在线播精品第三| 国产精品无人区| 色诱亚洲精品久久久久久| 一区二区三区日本| 91精品国产综合久久精品图片| 日本欧美在线观看| 久久久另类综合| 成人avav影音| 亚洲电影第三页| 日韩精品一区二区三区三区免费| 狠狠网亚洲精品| 综合自拍亚洲综合图不卡区| 色8久久人人97超碰香蕉987| 日本欧美在线观看| 久久久国产一区二区三区四区小说 | 国产精品一区二区不卡| 国产精品色在线观看| 欧美性videosxxxxx| 黄页视频在线91| 亚洲欧洲日本在线| 91精品国产色综合久久ai换脸 | 国产在线一区二区| 国产精品久久毛片a| 欧美日韩在线观看一区二区| 精品影视av免费| 自拍偷拍亚洲综合| 日韩亚洲欧美在线| 91麻豆.com| 久草这里只有精品视频| 一区二区国产视频| 亚洲精品一区二区三区四区高清 | 国产白丝精品91爽爽久久| 亚洲成在人线免费| 国产精品女上位| 日韩亚洲欧美在线| 欧美在线观看一二区| 成人午夜电影久久影院| 亚州成人在线电影| 亚洲欧美在线视频观看| 精品国产污污免费网站入口 | 色综合久久综合中文综合网| 久久精品国产秦先生| 一区二区三区高清在线| 欧美高清一级片在线观看| 欧美一卡2卡三卡4卡5免费| 色综合天天综合色综合av| 国产成人在线视频网址| 亚洲精品菠萝久久久久久久| www激情久久| 69p69国产精品| 色综合色综合色综合色综合色综合| 精品亚洲porn| 日韩av一区二区三区| 亚洲欧美日韩国产中文在线| 国产欧美视频一区二区| 精品处破学生在线二十三| 在线播放国产精品二区一二区四区 | 亚洲免费高清视频在线| 久久看人人爽人人| 日韩女优av电影| 777奇米成人网| 欧美日韩国产高清一区二区三区 | 欧美一区二区在线免费播放| 91久久线看在观草草青青| 成人精品视频.| av在线不卡电影| av成人免费在线观看| 成人在线视频一区| 成人激情黄色小说| 国产aⅴ精品一区二区三区色成熟| 久久精品国产精品亚洲综合| 麻豆freexxxx性91精品| 六月丁香综合在线视频| 久久精品免费看| 激情图区综合网| 国产99一区视频免费 | 亚洲国产精品黑人久久久| 亚洲精品一区二区三区蜜桃下载| 日韩欧美视频在线| 精品久久久久久久人人人人传媒| 欧美精品一区二区三区久久久| 2023国产精品视频| 久久久国产精华| 成人免费一区二区三区视频| 亚洲欧美一区二区在线观看| 亚洲综合一区二区| 日韩一区精品字幕| 精品一区二区久久| 风间由美一区二区av101| a美女胸又www黄视频久久| 91久久免费观看| 69堂精品视频| 精品精品国产高清a毛片牛牛 | 欧美一区二区三区视频| 精品国免费一区二区三区| 国产视频视频一区| 一个色综合网站| 奇米精品一区二区三区四区| 国产美女久久久久| 色婷婷久久久久swag精品| 91精品国产免费| 国产精品久久综合| 午夜免费久久看| 国产a区久久久| 在线成人av影院| 国产精品久久久久影视| 香蕉乱码成人久久天堂爱免费|