Changeset 60885 in webkit
- Timestamp:
- Jun 9, 2010 12:24:39 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r60880 r60885 1 2010-06-08 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 Implement non-scaling-stroke (from SVG Tiny 1.2, also in Opera) 6 https://bugs.webkit.org/show_bug.cgi?id=31438 7 8 Test for SVG property vector-effect. The stroke-width should not get influenced by 9 any transformation on the object or its parrent. 10 Some ports needed platform specific test results for getComputedStyle. 11 12 * platform/gtk/svg/css/getComputedStyle-basic-expected.txt: 13 * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt: 14 * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 15 * platform/mac/svg/custom/non-scaling-stroke-expected.checksum: Added. 16 * platform/mac/svg/custom/non-scaling-stroke-expected.png: Added. 17 * platform/mac/svg/custom/non-scaling-stroke-expected.txt: Added. 18 * platform/win/fast/css/getComputedStyle/computed-style-expected.txt: 19 * platform/win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 20 * svg/css/getComputedStyle-basic-expected.txt: 21 * svg/custom/non-scaling-stroke.svg: Added. 22 1 23 2010-05-18 Yuzo Fujishima <yuzo@google.com> 2 24 -
trunk/LayoutTests/platform/gtk/svg/css/getComputedStyle-basic-expected.txt
r60002 r60885 415 415 rect: style.getPropertyValue(-webkit-svg-shadow) : none 416 416 rect: style.getPropertyCSSValue(-webkit-svg-shadow) : [object CSSPrimitiveValue] 417 rect: style.getPropertyValue(vector-effect) : none 418 rect: style.getPropertyCSSValue(vector-effect) : [object CSSPrimitiveValue] 417 419 g: style.getPropertyValue(background-attachment) : scroll 418 420 g: style.getPropertyCSSValue(background-attachment) : [object CSSPrimitiveValue] … … 831 833 g: style.getPropertyValue(-webkit-svg-shadow) : none 832 834 g: style.getPropertyCSSValue(-webkit-svg-shadow) : [object CSSPrimitiveValue] 835 g: style.getPropertyValue(vector-effect) : none 836 g: style.getPropertyCSSValue(vector-effect) : [object CSSPrimitiveValue] 833 837 -
trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
r60862 r60885 210 210 glyph-orientation-vertical: auto; 211 211 -webkit-svg-shadow: none; 212 vector-effect: none; 212 213 213 214 Other attributes that the computed style class supports: -
trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r60862 r60885 209 209 glyph-orientation-vertical: auto 210 210 -webkit-svg-shadow: none 211 vector-effect: none 211 212 background-position-x: 0% 212 213 background-position-y: 0% -
trunk/LayoutTests/platform/win/fast/css/getComputedStyle/computed-style-expected.txt
r60179 r60885 209 209 glyph-orientation-vertical: auto; 210 210 -webkit-svg-shadow: none; 211 vector-effect: none; 211 212 212 213 Other attributes that the computed style class supports: -
trunk/LayoutTests/platform/win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r60179 r60885 208 208 glyph-orientation-vertical: auto 209 209 -webkit-svg-shadow: none 210 vector-effect: none 210 211 background-position-x: 0% 211 212 background-position-y: 0% -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r60862 r60885 417 417 rect: style.getPropertyValue(-webkit-svg-shadow) : none 418 418 rect: style.getPropertyCSSValue(-webkit-svg-shadow) : [object CSSPrimitiveValue] 419 rect: style.getPropertyValue(vector-effect) : none 420 rect: style.getPropertyCSSValue(vector-effect) : [object CSSPrimitiveValue] 419 421 g: style.getPropertyValue(background-attachment) : scroll 420 422 g: style.getPropertyCSSValue(background-attachment) : [object CSSPrimitiveValue] … … 835 837 g: style.getPropertyValue(-webkit-svg-shadow) : none 836 838 g: style.getPropertyCSSValue(-webkit-svg-shadow) : [object CSSPrimitiveValue] 839 g: style.getPropertyValue(vector-effect) : none 840 g: style.getPropertyCSSValue(vector-effect) : [object CSSPrimitiveValue] 837 841 -
trunk/WebCore/ChangeLog
r60882 r60885 1 2010-06-08 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 Implement non-scaling-stroke (from SVG Tiny 1.2, also in Opera) 6 https://bugs.webkit.org/show_bug.cgi?id=31438 7 8 This is the implementation of the SVG property vector-effect according 9 to the specification of SVG Tiny 1.2. 10 getScreenCTM() was not able to calculate the transformation matrix in 11 comparison to the host coordinate system for objects, that get refereced 12 by a use element. This is fixed and covered by the the new test as well. 13 This patch is based upon a patch of Jeff Schiller. 14 15 Test: svg/custom/non-scaling-stroke.svg 16 17 * css/CSSComputedStyleDeclaration.cpp: Added CSSPropertyVectorEffect. 18 (WebCore::): 19 * css/CSSPrimitiveValueMappings.h: 20 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 21 (WebCore::CSSPrimitiveValue::operator EVectorEffect): 22 * css/SVGCSSComputedStyleDeclaration.cpp: 23 (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): 24 * css/SVGCSSParser.cpp: 25 (WebCore::CSSParser::parseSVGValue): 26 * css/SVGCSSPropertyNames.in: 27 * css/SVGCSSStyleSelector.cpp: 28 (WebCore::CSSStyleSelector::applySVGProperty): 29 * css/SVGCSSValueKeywords.in: Add vector-effect value non-scaling-stroke. 30 * rendering/RenderPath.cpp: Revert transformations to ctm and transform path instead. 31 (WebCore::fillAndStrokePath): 32 * rendering/RenderSVGResourceContainer.h: 33 (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): 34 * rendering/RenderSVGResourceGradient.cpp: Transform the gradient with the screenCTM. 35 (WebCore::RenderSVGResourceGradient::applyResource): 36 * rendering/RenderSVGResourcePattern.cpp: Transform the pattern with the screenCTM. 37 (WebCore::RenderSVGResourcePattern::applyResource): 38 * rendering/style/SVGRenderStyle.h: Added vector-effect property, not interited. 39 (WebCore::SVGRenderStyle::NonInheritedFlags::): 40 (WebCore::SVGRenderStyle::setBitDefaults): 41 * rendering/style/SVGRenderStyleDefs.h: Added enums for vector-effect. 42 (WebCore::): 43 * svg/SVGLocatable.cpp: Calculate screenCTM for <use> referenced objects. 44 (WebCore::SVGLocatable::computeCTM): 45 * svg/SVGStyledElement.cpp: 46 (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName): 47 * svg/svgattrs.in: 48 1 49 2010-06-08 Mark Rowe <mrowe@apple.com> 2 50 -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r60862 r60885 265 265 CSSPropertyGlyphOrientationHorizontal, 266 266 CSSPropertyGlyphOrientationVertical, 267 CSSPropertyWebkitSvgShadow 267 CSSPropertyWebkitSvgShadow, 268 CSSPropertyVectorEffect 268 269 #endif 269 270 }; -
trunk/WebCore/css/CSSPrimitiveValueMappings.h
r60862 r60885 3 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 2600 2602 } 2601 2603 2604 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e) 2605 : m_type(CSS_IDENT) 2606 , m_hasCachedCSSText(false) 2607 { 2608 switch (e) { 2609 case VE_NONE: 2610 m_value.ident = CSSValueNone; 2611 break; 2612 case VE_NON_SCALING_STROKE: 2613 m_value.ident = CSSValueNonScalingStroke; 2614 break; 2615 } 2616 } 2617 2618 template<> inline CSSPrimitiveValue::operator EVectorEffect() const 2619 { 2620 switch (m_value.ident) { 2621 case CSSValueNone: 2622 return VE_NONE; 2623 case CSSValueNonScalingStroke: 2624 return VE_NON_SCALING_STROKE; 2625 default: 2626 ASSERT_NOT_REACHED(); 2627 return VE_NONE; 2628 } 2629 } 2630 2602 2631 #endif 2603 2632 -
trunk/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
r60862 r60885 169 169 case CSSPropertyWebkitSvgShadow: 170 170 return valueForShadow(svgStyle->shadow(), propertyID); 171 case CSSPropertyVectorEffect: 172 return CSSPrimitiveValue::create(svgStyle->vectorEffect()); 171 173 case CSSPropertyMarker: 172 174 case CSSPropertyEnableBackground: -
trunk/WebCore/css/SVGCSSParser.cpp
r60862 r60885 221 221 m_valueList->next(); 222 222 223 break; 224 225 case CSSPropertyVectorEffect: // none | non-scaling-stroke | inherit 226 if (id == CSSValueNone || id == CSSValueNonScalingStroke) 227 valid_primitive = true; 223 228 break; 224 229 -
trunk/WebCore/css/SVGCSSPropertyNames.in
r60862 r60885 46 46 kerning 47 47 text-anchor 48 vector-effect 48 49 writing-mode 49 50 -
trunk/WebCore/css/SVGCSSStyleSelector.cpp
r60862 r60885 553 553 return; 554 554 } 555 case CSSPropertyVectorEffect: { 556 HANDLE_INHERIT_AND_INITIAL(vectorEffect, VectorEffect) 557 if (!primitiveValue) 558 break; 559 560 svgstyle->setVectorEffect(*primitiveValue); 561 break; 562 } 555 563 default: 556 564 // If you crash here, it's because you added a css property and are not handling it -
trunk/WebCore/css/SVGCSSValueKeywords.in
r60862 r60885 274 274 # end 275 275 276 # CSS_PROP_VECTOR_EFFECT 277 # none 278 non-scaling-stroke 279 280 276 281 # CSS_PROP_WRITING_MODE 277 282 lr-tb -
trunk/WebCore/rendering/RenderPath.cpp
r60862 r60885 6 6 2009 Dirk Schulze <krit@webkit.org> 7 7 Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 2009 Jeff Schiller <codedread@gmail.com> 8 9 9 10 This library is free software; you can redistribute it and/or … … 132 133 { 133 134 context->beginPath(); 134 135 if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, object->style())) { 135 RenderStyle* style = object->style(); 136 137 if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, style)) { 136 138 context->addPath(path); 137 if (fillPaintingResource->applyResource(object, object->style(), context, ApplyToFillMode))139 if (fillPaintingResource->applyResource(object, style, context, ApplyToFillMode)) 138 140 fillPaintingResource->postApplyResource(object, context, ApplyToFillMode); 139 141 } 140 142 141 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, object->style())) { 142 context->addPath(path); 143 if (strokePaintingResource->applyResource(object, object->style(), context, ApplyToStrokeMode)) 143 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, style)) { 144 if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) { 145 SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); 146 AffineTransform transform = element->getScreenCTM(); 147 if (!transform.isInvertible()) 148 return; 149 150 Path transformedPath = path; 151 context->concatCTM(transform.inverse()); 152 transformedPath.transform(transform); 153 context->addPath(transformedPath); 154 } else 155 context->addPath(path); 156 if (strokePaintingResource->applyResource(object, style, context, ApplyToStrokeMode)) 144 157 strokePaintingResource->postApplyResource(object, context, ApplyToStrokeMode); 145 158 } -
trunk/WebCore/rendering/RenderSVGResourceContainer.h
r60862 r60885 24 24 #if ENABLE(SVG) 25 25 #include "RenderSVGHiddenContainer.h" 26 27 #include "SVGStyledTransformableElement.h" 26 28 #include "RenderSVGResource.h" 27 29 … … 81 83 82 84 virtual RenderSVGResourceContainer* toRenderSVGResourceContainer() { return this; } 85 86 static AffineTransform transformOnNonScalingStroke(RenderObject* object, const AffineTransform resourceTransform) 87 { 88 if (!object->isRenderPath()) 89 return resourceTransform; 90 91 SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); 92 AffineTransform transform = resourceTransform; 93 transform.multiply(element->getScreenCTM()); 94 return transform; 95 } 83 96 84 97 private: -
trunk/WebCore/rendering/RenderSVGResourceGradient.cpp
r60862 r60885 208 208 context->setFillRule(svgStyle->fillRule()); 209 209 } else if (resourceMode & ApplyToStrokeMode) { 210 if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) 211 gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform)); 210 212 context->setAlpha(svgStyle->strokeOpacity()); 211 213 context->setStrokeGradient(gradientData->gradient); -
trunk/WebCore/rendering/RenderSVGResourcePattern.cpp
r60862 r60885 117 117 context->setFillRule(svgStyle->fillRule()); 118 118 } else if (resourceMode & ApplyToStrokeMode) { 119 if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE) 120 patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(object, patternData->transform)); 119 121 context->setAlpha(svgStyle->strokeOpacity()); 120 122 context->setStrokePattern(patternData->pattern); -
trunk/WebCore/rendering/style/SVGRenderStyle.h
r60862 r60885 59 59 SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) 60 60 SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) 61 SVG_RS_DEFINE_ATTRIBUTE(EVectorEffect, VectorEffect, vectorEffect, VE_NONE) 61 62 62 63 SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) … … 169 170 unsigned _dominantBaseline : 4; // EDominantBaseline 170 171 unsigned _baselineShift : 2; // EBaselineShift 171 // 22 bits unused 172 unsigned _vectorEffect: 1; // EVectorEffect 173 // 21 bits unused 172 174 } f; 173 175 uint32_t _niflags; … … 214 216 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); 215 217 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 218 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 216 219 } 217 220 }; -
trunk/WebCore/rendering/style/SVGRenderStyleDefs.h
r60862 r60885 122 122 DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE 123 123 }; 124 125 enum EVectorEffect { 126 VE_NONE, 127 VE_NON_SCALING_STROKE 128 }; 124 129 125 130 class CSSValue; -
trunk/WebCore/svg/SVGLocatable.cpp
r60862 r60885 92 92 93 93 SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportElement(element) : 0; 94 for (const Node* current = element; current && current->isSVGElement(); current = current->parentNode()) { 95 const SVGElement* currentElement = static_cast<const SVGElement*>(current); 94 95 Node* current = const_cast<SVGElement*>(element); 96 while (current && current->isSVGElement()) { 97 SVGElement* currentElement = static_cast<SVGElement*>(current); 96 98 if (currentElement->isStyled()) 97 ctm = static_cast< constSVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm);99 ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm); 98 100 99 101 // For getCTM() computation, stop at the nearest viewport element 100 102 if (currentElement == stopAtElement) 101 103 break; 104 105 current = current->isShadowNode() ? current->shadowParentNode() : current->parentNode(); 102 106 } 103 107 -
trunk/WebCore/svg/SVGStyledElement.cpp
r60862 r60885 186 186 mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr); 187 187 mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr); 188 mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr); 188 189 mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr); 189 190 mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr); -
trunk/WebCore/svg/svgattrs.in
r60862 r60885 229 229 v-mathematical 230 230 values 231 vector-effect 231 232 version 232 233 vert-adv-y
Note: See TracChangeset
for help on using the changeset viewer.