⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 render_style.cpp

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/* * This file is part of the DOM implementation for KDE. * * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002-2004 Apple Computer, Inc. * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) * * 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., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */#include "xml/dom_stringimpl.h"#include "css/cssstyleselector.h"#include "css/css_valueimpl.h"#include "render_style.h"#include "kdebug.h"using namespace khtml;using namespace DOM;/* CSS says Fixed for the default padding value, but we treat variable as 0 padding anyways, and like * this is works fine for table paddings aswell */StyleSurroundData::StyleSurroundData()    : margin( Fixed ), padding( Variable ){}StyleSurroundData::StyleSurroundData(const StyleSurroundData& o )    : Shared<StyleSurroundData>(),      offset( o.offset ), margin( o.margin ), padding( o.padding ),      border( o.border ){}bool StyleSurroundData::operator==(const StyleSurroundData& o) const{    return offset==o.offset && margin==o.margin &&	padding==o.padding && border==o.border;}StyleBoxData::StyleBoxData()    : z_index( 0 ), z_auto( true ){    min_width = min_height = RenderStyle::initialMinSize();    max_width = max_height = RenderStyle::initialMaxSize();    box_sizing = RenderStyle::initialBoxSizing();}StyleBoxData::StyleBoxData(const StyleBoxData& o )    : Shared<StyleBoxData>(),      width( o.width ), height( o.height ),      min_width( o.min_width ), max_width( o.max_width ),      min_height ( o.min_height ), max_height( o.max_height ),      box_sizing( o.box_sizing),      z_index( o.z_index ), z_auto( o.z_auto ){}bool StyleBoxData::operator==(const StyleBoxData& o) const{    return	    width == o.width &&	    height == o.height &&	    min_width == o.min_width &&	    max_width == o.max_width &&	    min_height == o.min_height &&	    max_height == o.max_height &&            box_sizing == o.box_sizing &&	    z_index == o.z_index &&            z_auto == o.z_auto;}StyleVisualData::StyleVisualData()     : textDecoration(RenderStyle::initialTextDecoration()),      palette( QApplication::palette() ){}StyleVisualData::~StyleVisualData() {}StyleVisualData::StyleVisualData(const StyleVisualData& o )    : Shared<StyleVisualData>(),      clip( o.clip ), textDecoration(o.textDecoration),      palette( o.palette ){}BackgroundLayer::BackgroundLayer():m_image(RenderStyle::initialBackgroundImage()), m_bgAttachment(RenderStyle::initialBackgroundAttachment()), m_bgRepeat(RenderStyle::initialBackgroundRepeat()), m_next(0){    m_imageSet = m_attachmentSet = m_repeatSet = m_xPosSet = m_yPosSet = false;}BackgroundLayer::BackgroundLayer(const BackgroundLayer& o){    m_next = o.m_next ? new BackgroundLayer(*o.m_next) : 0;    m_image = o.m_image;    m_xPosition = o.m_xPosition;    m_yPosition = o.m_yPosition;    m_bgAttachment = o.m_bgAttachment;    m_bgRepeat = o.m_bgRepeat;    m_imageSet = o.m_imageSet;    m_attachmentSet = o.m_attachmentSet;    m_repeatSet = o.m_repeatSet;    m_xPosSet = o.m_xPosSet;    m_yPosSet = o.m_yPosSet;}BackgroundLayer::~BackgroundLayer(){    delete m_next;}BackgroundLayer& BackgroundLayer::operator=(const BackgroundLayer& o) {    if (m_next != o.m_next) {        delete m_next;        m_next = o.m_next ? new BackgroundLayer(*o.m_next) : 0;    }    m_image = o.m_image;    m_xPosition = o.m_xPosition;    m_yPosition = o.m_yPosition;    m_bgAttachment = o.m_bgAttachment;    m_bgRepeat = o.m_bgRepeat;    m_imageSet = o.m_imageSet;    m_attachmentSet = o.m_attachmentSet;    m_repeatSet = o.m_repeatSet;    m_xPosSet = o.m_xPosSet;    m_yPosSet = o.m_yPosSet;    return *this;}bool BackgroundLayer::operator==(const BackgroundLayer& o) const {    return m_image == o.m_image && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition &&           m_bgAttachment == o.m_bgAttachment && m_bgRepeat == o.m_bgRepeat &&           m_imageSet == o.m_imageSet && m_attachmentSet == o.m_attachmentSet && m_repeatSet == o.m_repeatSet &&           m_xPosSet == o.m_xPosSet && m_yPosSet == o.m_yPosSet &&           ((m_next && o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);}void BackgroundLayer::fillUnsetProperties(){    BackgroundLayer* curr;    for (curr = this; curr && curr->isBackgroundImageSet(); curr = curr->next());    if (curr && curr != this) {        // We need to fill in the remaining values with the pattern specified.        for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {            curr->m_image = pattern->m_image;            pattern = pattern->next();            if (pattern == curr || !pattern)                pattern = this;        }    }    for (curr = this; curr && curr->isBackgroundXPositionSet(); curr = curr->next());    if (curr && curr != this) {        // We need to fill in the remaining values with the pattern specified.        for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {            curr->m_xPosition = pattern->m_xPosition;            pattern = pattern->next();            if (pattern == curr || !pattern)                pattern = this;        }    }    for (curr = this; curr && curr->isBackgroundYPositionSet(); curr = curr->next());    if (curr && curr != this) {        // We need to fill in the remaining values with the pattern specified.        for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {            curr->m_yPosition = pattern->m_yPosition;            pattern = pattern->next();            if (pattern == curr || !pattern)                pattern = this;        }    }    for (curr = this; curr && curr->isBackgroundAttachmentSet(); curr = curr->next());    if (curr && curr != this) {        // We need to fill in the remaining values with the pattern specified.        for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {            curr->m_bgAttachment = pattern->m_bgAttachment;            pattern = pattern->next();            if (pattern == curr || !pattern)                pattern = this;        }    }    for (curr = this; curr && curr->isBackgroundRepeatSet(); curr = curr->next());    if (curr && curr != this) {        // We need to fill in the remaining values with the pattern specified.        for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {            curr->m_bgRepeat = pattern->m_bgRepeat;            pattern = pattern->next();            if (pattern == curr || !pattern)                pattern = this;        }    }}void BackgroundLayer::cullEmptyLayers(){    BackgroundLayer *next;    for (BackgroundLayer *p = this; p; p = next) {        next = p->m_next;        if (next && !next->isBackgroundImageSet() &&            !next->isBackgroundXPositionSet() && !next->isBackgroundYPositionSet() &&            !next->isBackgroundAttachmentSet() && !next->isBackgroundRepeatSet()) {            delete next;            p->m_next = 0;            break;        }    }}StyleBackgroundData::StyleBackgroundData(){}StyleBackgroundData::StyleBackgroundData(const StyleBackgroundData& o)    : Shared<StyleBackgroundData>(), m_background(o.m_background), m_outline(o.m_outline){}bool StyleBackgroundData::operator==(const StyleBackgroundData& o) const{    return m_background == o.m_background && m_color == o.m_color && m_outline == o.m_outline;}StyleMarqueeData::StyleMarqueeData(){    increment = RenderStyle::initialMarqueeIncrement();    speed = RenderStyle::initialMarqueeSpeed();    direction = RenderStyle::initialMarqueeDirection();    behavior = RenderStyle::initialMarqueeBehavior();    loops = RenderStyle::initialMarqueeLoopCount();}StyleMarqueeData::StyleMarqueeData(const StyleMarqueeData& o):Shared<StyleMarqueeData>(), increment(o.increment), speed(o.speed), loops(o.loops), behavior(o.behavior), direction(o.direction){}bool StyleMarqueeData::operator==(const StyleMarqueeData& o) const{    return (increment == o.increment && speed == o.speed && direction == o.direction &&            behavior == o.behavior && loops == o.loops);}StyleCSS3NonInheritedData::StyleCSS3NonInheritedData():Shared<StyleCSS3NonInheritedData>(), opacity(RenderStyle::initialOpacity()){}StyleCSS3NonInheritedData::StyleCSS3NonInheritedData(const StyleCSS3NonInheritedData& o):Shared<StyleCSS3NonInheritedData>(), opacity(o.opacity),#ifdef APPLE_CHANGES flexibleBox(o.flexibleBox),#endif marquee(o.marquee){}bool StyleCSS3NonInheritedData::operator==(const StyleCSS3NonInheritedData& o) const{    return     opacity == o.opacity &&#ifdef APPLE_CHANGES     flexibleBox == o.flexibleBox &&#endif     marquee == o.marquee;}StyleCSS3InheritedData::StyleCSS3InheritedData():Shared<StyleCSS3InheritedData>(), textShadow(0)#ifdef APPLE_CHANGES, userModify(READ_ONLY), textSizeAdjust(RenderStyle::initialTextSizeAdjust())#endif{}StyleCSS3InheritedData::StyleCSS3InheritedData(const StyleCSS3InheritedData& o):Shared<StyleCSS3InheritedData>(){    textShadow = o.textShadow ? new ShadowData(*o.textShadow) : 0;#ifdef APPLE_CHANGES    userModify = o.userModify;    textSizeAdjust = o.textSizeAdjust;#endif}StyleCSS3InheritedData::~StyleCSS3InheritedData(){    delete textShadow;}bool StyleCSS3InheritedData::operator==(const StyleCSS3InheritedData& o) const{    return shadowDataEquivalent(o)#ifdef APPLE_CHANGES            && (userModify == o.userModify) && (textSizeAdjust == o.textSizeAdjust)#endif    ;}bool StyleCSS3InheritedData::shadowDataEquivalent(const StyleCSS3InheritedData& o) const{    if (!textShadow && o.textShadow || textShadow && !o.textShadow)        return false;    if (textShadow && o.textShadow && (*textShadow != *o.textShadow))        return false;    return true;}StyleInheritedData::StyleInheritedData()    : indent( RenderStyle::initialTextIndent() ), line_height( RenderStyle::initialLineHeight() ),      style_image( RenderStyle::initialListStyleImage() ),      font(), color( RenderStyle::initialColor() ),      border_hspacing( RenderStyle::initialBorderHorizontalSpacing() ),      border_vspacing( RenderStyle::initialBorderVerticalSpacing() ),      widows( RenderStyle::initialWidows() ), orphans( RenderStyle::initialOrphans() ),      quotes(0){}StyleInheritedData::~StyleInheritedData(){    if (quotes) quotes->deref();}StyleInheritedData::StyleInheritedData(const StyleInheritedData& o )    : Shared<StyleInheritedData>(),      indent( o.indent ), line_height( o.line_height ), style_image( o.style_image ),      font( o.font ), color( o.color ),      border_hspacing( o.border_hspacing ),      border_vspacing( o.border_vspacing ),      widows(o.widows), orphans(o.orphans){    quotes = o.quotes;    if (quotes) quotes->ref();}bool StyleInheritedData::operator==(const StyleInheritedData& o) const{    return	indent == o.indent &&	line_height == o.line_height &&        border_hspacing == o.border_hspacing &&        border_vspacing == o.border_vspacing &&	style_image == o.style_image &&

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -