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

📄 cssprimitivevaluemappings.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. * Copyright (C) 2008 Apple 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 THE AUTHOR ``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 THE AUTHOR 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. */#ifndef CSSPrimitiveValueMappings_h#define CSSPrimitiveValueMappings_h#include "CSSPrimitiveValue.h"#include "CSSValueKeywords.h"#include "GraphicsTypes.h"#include "Path.h"#include "RenderStyleConstants.h"#include "SVGRenderStyleDefs.h"#include "TextDirection.h"#include "ThemeTypes.h"namespace WebCore {template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)    : m_type(CSS_IDENT){    switch (e) {        case BNONE:            m_value.ident = CSSValueNone;            break;        case BHIDDEN:            m_value.ident = CSSValueHidden;            break;        case INSET:            m_value.ident = CSSValueInset;            break;        case GROOVE:            m_value.ident = CSSValueGroove;            break;        case RIDGE:            m_value.ident = CSSValueRidge;            break;        case OUTSET:            m_value.ident = CSSValueOutset;            break;        case DOTTED:            m_value.ident = CSSValueDotted;            break;        case DASHED:            m_value.ident = CSSValueDashed;            break;        case SOLID:            m_value.ident = CSSValueSolid;            break;        case DOUBLE:            m_value.ident = CSSValueDouble;            break;    }}template<> inline CSSPrimitiveValue::operator EBorderStyle() const{    return (EBorderStyle)(m_value.ident - CSSValueNone);}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)    : m_type(CSS_IDENT){    switch (e) {        case CompositeClear:            m_value.ident = CSSValueClear;            break;        case CompositeCopy:            m_value.ident = CSSValueCopy;            break;        case CompositeSourceOver:            m_value.ident = CSSValueSourceOver;            break;        case CompositeSourceIn:            m_value.ident = CSSValueSourceIn;            break;        case CompositeSourceOut:            m_value.ident = CSSValueSourceOut;            break;        case CompositeSourceAtop:            m_value.ident = CSSValueSourceAtop;            break;        case CompositeDestinationOver:            m_value.ident = CSSValueDestinationOver;            break;        case CompositeDestinationIn:            m_value.ident = CSSValueDestinationIn;            break;        case CompositeDestinationOut:            m_value.ident = CSSValueDestinationOut;            break;        case CompositeDestinationAtop:            m_value.ident = CSSValueDestinationAtop;            break;        case CompositeXOR:            m_value.ident = CSSValueXor;            break;        case CompositePlusDarker:            m_value.ident = CSSValuePlusDarker;            break;        case CompositeHighlight:            m_value.ident = CSSValueHighlight;            break;        case CompositePlusLighter:            m_value.ident = CSSValuePlusLighter;            break;    }}template<> inline CSSPrimitiveValue::operator CompositeOperator() const{    switch (m_value.ident) {        case CSSValueClear:            return CompositeClear;        case CSSValueCopy:            return CompositeCopy;        case CSSValueSourceOver:            return CompositeSourceOver;        case CSSValueSourceIn:            return CompositeSourceIn;        case CSSValueSourceOut:            return CompositeSourceOut;        case CSSValueSourceAtop:            return CompositeSourceAtop;        case CSSValueDestinationOver:            return CompositeDestinationOver;        case CSSValueDestinationIn:            return CompositeDestinationIn;        case CSSValueDestinationOut:            return CompositeDestinationOut;        case CSSValueDestinationAtop:            return CompositeDestinationAtop;        case CSSValueXor:            return CompositeXOR;        case CSSValuePlusDarker:            return CompositePlusDarker;        case CSSValueHighlight:            return CompositeHighlight;        case CSSValuePlusLighter:            return CompositePlusLighter;        default:            ASSERT_NOT_REACHED();            return CompositeClear;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)    : m_type(CSS_IDENT){    switch (e) {        case NoControlPart:            m_value.ident = CSSValueNone;            break;        case CheckboxPart:            m_value.ident = CSSValueCheckbox;            break;        case RadioPart:            m_value.ident = CSSValueRadio;            break;        case PushButtonPart:            m_value.ident = CSSValuePushButton;            break;        case SquareButtonPart:            m_value.ident = CSSValueSquareButton;            break;        case ButtonPart:            m_value.ident = CSSValueButton;            break;        case ButtonBevelPart:            m_value.ident = CSSValueButtonBevel;            break;        case DefaultButtonPart:            m_value.ident = CSSValueDefaultButton;            break;        case ListboxPart:            m_value.ident = CSSValueListbox;            break;        case ListItemPart:            m_value.ident = CSSValueListitem;            break;        case MediaFullscreenButtonPart:            m_value.ident = CSSValueMediaFullscreenButton;            break;        case MediaPlayButtonPart:            m_value.ident = CSSValueMediaPlayButton;            break;        case MediaMuteButtonPart:            m_value.ident = CSSValueMediaMuteButton;            break;        case MediaSeekBackButtonPart:            m_value.ident = CSSValueMediaSeekBackButton;            break;        case MediaSeekForwardButtonPart:            m_value.ident = CSSValueMediaSeekForwardButton;            break;        case MediaSliderPart:            m_value.ident = CSSValueMediaSlider;            break;        case MediaSliderThumbPart:            m_value.ident = CSSValueMediaSliderthumb;            break;        case MediaTimelineContainerPart:            m_value.ident = CSSValueMediaTimelineContainer;            break;        case MediaCurrentTimePart:            m_value.ident = CSSValueMediaCurrentTimeDisplay;            break;        case MediaTimeRemainingPart:            m_value.ident = CSSValueMediaTimeRemainingDisplay;            break;        case MenulistPart:            m_value.ident = CSSValueMenulist;            break;        case MenulistButtonPart:            m_value.ident = CSSValueMenulistButton;            break;        case MenulistTextPart:            m_value.ident = CSSValueMenulistText;            break;        case MenulistTextFieldPart:            m_value.ident = CSSValueMenulistTextfield;            break;        case SliderHorizontalPart:            m_value.ident = CSSValueSliderHorizontal;            break;        case SliderVerticalPart:            m_value.ident = CSSValueSliderVertical;            break;        case SliderThumbHorizontalPart:            m_value.ident = CSSValueSliderthumbHorizontal;            break;        case SliderThumbVerticalPart:            m_value.ident = CSSValueSliderthumbVertical;            break;        case CaretPart:            m_value.ident = CSSValueCaret;            break;        case SearchFieldPart:            m_value.ident = CSSValueSearchfield;            break;        case SearchFieldDecorationPart:            m_value.ident = CSSValueSearchfieldDecoration;            break;        case SearchFieldResultsDecorationPart:            m_value.ident = CSSValueSearchfieldResultsDecoration;            break;        case SearchFieldResultsButtonPart:            m_value.ident = CSSValueSearchfieldResultsButton;            break;        case SearchFieldCancelButtonPart:            m_value.ident = CSSValueSearchfieldCancelButton;            break;        case TextFieldPart:            m_value.ident = CSSValueTextfield;            break;        case TextAreaPart:            m_value.ident = CSSValueTextarea;            break;        case CapsLockIndicatorPart:            m_value.ident = CSSValueCapsLockIndicator;            break;    }}template<> inline CSSPrimitiveValue::operator ControlPart() const{    if (m_value.ident == CSSValueNone)        return NoControlPart;    else        return ControlPart(m_value.ident - CSSValueCheckbox + 1);}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)    : m_type(CSS_IDENT){    switch (e) {        case BorderFillBox:            m_value.ident = CSSValueBorder;            break;        case PaddingFillBox:            m_value.ident = CSSValuePadding;            break;        case ContentFillBox:            m_value.ident = CSSValueContent;            break;        case TextFillBox:            m_value.ident = CSSValueText;            break;    }}template<> inline CSSPrimitiveValue::operator EFillBox() const{    switch (m_value.ident) {        case CSSValueBorder:            return BorderFillBox;        case CSSValuePadding:            return PaddingFillBox;        case CSSValueContent:            return ContentFillBox;        case CSSValueText:            return TextFillBox;        default:            ASSERT_NOT_REACHED();            return BorderFillBox;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)    : m_type(CSS_IDENT){    switch (e) {        case RepeatFill:            m_value.ident = CSSValueRepeat;            break;        case RepeatXFill:            m_value.ident = CSSValueRepeatX;            break;        case RepeatYFill:            m_value.ident = CSSValueRepeatY;            break;        case NoRepeatFill:            m_value.ident = CSSValueNoRepeat;            break;    }}template<> inline CSSPrimitiveValue::operator EFillRepeat() const{    switch (m_value.ident) {        case CSSValueRepeat:            return RepeatFill;        case CSSValueRepeatX:            return RepeatXFill;        case CSSValueRepeatY:            return RepeatYFill;        case CSSValueNoRepeat:            return NoRepeatFill;        default:            ASSERT_NOT_REACHED();            return RepeatFill;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)    : m_type(CSS_IDENT){    switch (e) {        case BSTRETCH:            m_value.ident = CSSValueStretch;            break;        case BSTART:            m_value.ident = CSSValueStart;            break;        case BCENTER:            m_value.ident = CSSValueCenter;            break;        case BEND:            m_value.ident = CSSValueEnd;            break;        case BBASELINE:            m_value.ident = CSSValueBaseline;            break;        case BJUSTIFY:            m_value.ident = CSSValueJustify;            break;    }}template<> inline CSSPrimitiveValue::operator EBoxAlignment() const{    switch (m_value.ident) {        case CSSValueStretch:            return BSTRETCH;        case CSSValueStart:            return BSTART;        case CSSValueEnd:            return BEND;        case CSSValueCenter:            return BCENTER;        case CSSValueBaseline:            return BBASELINE;        case CSSValueJustify:            return BJUSTIFY;        default:            ASSERT_NOT_REACHED();            return BSTRETCH;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)    : m_type(CSS_IDENT){    switch (e) {        case BNORMAL:            m_value.ident = CSSValueNormal;            break;        case BREVERSE:            m_value.ident = CSSValueReverse;            break;    }}template<> inline CSSPrimitiveValue::operator EBoxDirection() const{    switch (m_value.ident) {        case CSSValueNormal:            return BNORMAL;        case CSSValueReverse:            return BREVERSE;        default:            ASSERT_NOT_REACHED();            return BNORMAL;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)    : m_type(CSS_IDENT){    switch (e) {        case SINGLE:            m_value.ident = CSSValueSingle;            break;        case MULTIPLE:            m_value.ident = CSSValueMultiple;            break;    }}template<> inline CSSPrimitiveValue::operator EBoxLines() const{    switch (m_value.ident) {        case CSSValueSingle:            return SINGLE;        case CSSValueMultiple:            return MULTIPLE;        default:            ASSERT_NOT_REACHED();            return SINGLE;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)    : m_type(CSS_IDENT){    switch (e) {        case HORIZONTAL:            m_value.ident = CSSValueHorizontal;            break;        case VERTICAL:            m_value.ident = CSSValueVertical;            break;    }}template<> inline CSSPrimitiveValue::operator EBoxOrient() const{    switch (m_value.ident) {        case CSSValueHorizontal:        case CSSValueInlineAxis:            return HORIZONTAL;        case CSSValueVertical:            return VERTICAL;        default:            ASSERT_NOT_REACHED();            return HORIZONTAL;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)    : m_type(CSS_IDENT){    switch (e) {        case CAPLEFT:            m_value.ident = CSSValueLeft;            break;        case CAPRIGHT:            m_value.ident = CSSValueRight;            break;        case CAPTOP:            m_value.ident = CSSValueTop;            break;        case CAPBOTTOM:            m_value.ident = CSSValueBottom;            break;    }}template<> inline CSSPrimitiveValue::operator ECaptionSide() const{    switch (m_value.ident) {        case CSSValueLeft:            return CAPLEFT;        case CSSValueRight:            return CAPRIGHT;        case CSSValueTop:            return CAPTOP;        case CSSValueBottom:            return CAPBOTTOM;        default:            ASSERT_NOT_REACHED();            return CAPTOP;    }}template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)    : m_type(CSS_IDENT){    switch (e) {        case CNONE:            m_value.ident = CSSValueNone;            break;        case CLEFT:            m_value.ident = CSSValueLeft;            break;        case CRIGHT:            m_value.ident = CSSValueRight;            break;        case CBOTH:            m_value.ident = CSSValueBoth;            break;    }}template<> inline CSSPrimitiveValue::operator EClear() const{    switch (m_value.ident) {        case CSSValueNone:            return CNONE;        case CSSValueLeft:            return CLEFT;        case CSSValueRight:            return CRIGHT;

⌨️ 快捷键说明

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