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

📄 svgcssstyleselector.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        {            HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)            if (!primitiveValue)                return;                    float f = 0.0f;                int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)                f = primitiveValue->getFloatValue() / 100.0f;            else if (type == CSSPrimitiveValue::CSS_NUMBER)                f = primitiveValue->getFloatValue();            else                return;            svgstyle->setFillOpacity(f);            break;        }        case CSSPropertyStrokeOpacity:        {            HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)            if (!primitiveValue)                return;                    float f = 0.0f;                int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)                f = primitiveValue->getFloatValue() / 100.0f;            else if (type == CSSPrimitiveValue::CSS_NUMBER)                f = primitiveValue->getFloatValue();            else                return;            svgstyle->setStrokeOpacity(f);            break;        }        case CSSPropertyStopOpacity:        {            HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)            if (!primitiveValue)                return;                    float f = 0.0f;                int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)                f = primitiveValue->getFloatValue() / 100.0f;            else if (type == CSSPrimitiveValue::CSS_NUMBER)                f = primitiveValue->getFloatValue();            else                return;            svgstyle->setStopOpacity(f);            break;        }        case CSSPropertyMarkerStart:        {            HANDLE_INHERIT_AND_INITIAL(startMarker, StartMarker)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setStartMarker(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyMarkerMid:        {            HANDLE_INHERIT_AND_INITIAL(midMarker, MidMarker)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setMidMarker(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyMarkerEnd:        {            HANDLE_INHERIT_AND_INITIAL(endMarker, EndMarker)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setEndMarker(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyStrokeLinecap:        {            HANDLE_INHERIT_AND_INITIAL(capStyle, CapStyle)            if (primitiveValue)                svgstyle->setCapStyle(*primitiveValue);            break;        }        case CSSPropertyStrokeMiterlimit:        {            HANDLE_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)            if (!primitiveValue)                return;            float f = 0.0f;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_NUMBER)                f = primitiveValue->getFloatValue();            else                return;            svgstyle->setStrokeMiterLimit(f);            break;        }        case CSSPropertyFilter:        {            HANDLE_INHERIT_AND_INITIAL(filter, Filter)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setFilter(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyMask:        {            HANDLE_INHERIT_AND_INITIAL(maskElement, MaskElement)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setMaskElement(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyClipPath:        {            HANDLE_INHERIT_AND_INITIAL(clipPath, ClipPath)            if (!primitiveValue)                return;            String s;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_URI)                s = primitiveValue->getStringValue();            else                return;            svgstyle->setClipPath(SVGURIReference::getTarget(s));            break;        }        case CSSPropertyTextAnchor:        {            HANDLE_INHERIT_AND_INITIAL(textAnchor, TextAnchor)            if (primitiveValue)                svgstyle->setTextAnchor(*primitiveValue);            break;        }        case CSSPropertyWritingMode:        {            HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode)            if (primitiveValue)                svgstyle->setWritingMode(*primitiveValue);            break;        }        case CSSPropertyStopColor:        {            HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor);            SVGColor* c = static_cast<SVGColor*>(value);            if (!c)                return CSSStyleSelector::applyProperty(id, value);            Color col;            if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)                col = m_style->color();            else                col = c->color();            svgstyle->setStopColor(col);            break;        }       case CSSPropertyLightingColor:        {            HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor);            SVGColor* c = static_cast<SVGColor*>(value);            if (!c)                return CSSStyleSelector::applyProperty(id, value);            Color col;            if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)                col = m_style->color();            else                col = c->color();            svgstyle->setLightingColor(col);            break;        }        case CSSPropertyFloodOpacity:        {            HANDLE_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)            if (!primitiveValue)                return;            float f = 0.0f;            int type = primitiveValue->primitiveType();            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)                f = primitiveValue->getFloatValue() / 100.0f;            else if (type == CSSPrimitiveValue::CSS_NUMBER)                f = primitiveValue->getFloatValue();            else                return;            svgstyle->setFloodOpacity(f);            break;        }        case CSSPropertyFloodColor:        {            Color col;            if (isInitial)                col = SVGRenderStyle::initialFloodColor();            else {                SVGColor *c = static_cast<SVGColor*>(value);                if (!c)                    return CSSStyleSelector::applyProperty(id, value);                if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)                    col = m_style->color();                else                    col = c->color();            }            svgstyle->setFloodColor(col);            break;        }        case CSSPropertyGlyphOrientationHorizontal:        {            HANDLE_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientationHorizontal)            if (!primitiveValue)                return;            if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {                int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());                ASSERT(orientation != -1);                svgstyle->setGlyphOrientationHorizontal((EGlyphOrientation) orientation);            }            break;        }        case CSSPropertyGlyphOrientationVertical:        {            HANDLE_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientationVertical)            if (!primitiveValue)                return;            if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {                int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());                ASSERT(orientation != -1);                svgstyle->setGlyphOrientationVertical((EGlyphOrientation) orientation);            } else if (primitiveValue->getIdent() == CSSValueAuto)                svgstyle->setGlyphOrientationVertical(GO_AUTO);            break;        }        case CSSPropertyEnableBackground:            // Silently ignoring this property for now            // http://bugs.webkit.org/show_bug.cgi?id=6022            break;        default:            // If you crash here, it's because you added a css property and are not handling it            // in either this switch statement or the one in CSSStyleSelector::applyProperty            ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id);            return;    }}}// vim:ts=4:noet#endif // ENABLE(SVG)

⌨️ 快捷键说明

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