Changeset 129018 in webkit
- Timestamp:
- Sep 19, 2012 10:50:26 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r129014 r129018 1 2012-09-18 Dirk Schulze <krit@webkit.org> 2 3 Implement 'mask-type' for <mask> 4 https://bugs.webkit.org/show_bug.cgi?id=97011 5 6 Reviewed by Andreas Kling. 7 8 Added new tests for switching the masking mode on <mask> element with 'mask-type'. 9 10 * svg/css/mask-type-expected.txt: Added. 11 * svg/css/mask-type.html: Added. 12 * svg/masking/mask-type-alpha-expected.svg: Added. 13 * svg/masking/mask-type-alpha.svg: Added. 14 * svg/masking/mask-type-luminance-expected.svg: Added. 15 * svg/masking/mask-type-luminance.svg: Added. 16 * svg/masking/mask-type-not-set-expected.svg: Added. 17 * svg/masking/mask-type-not-set.svg: Added. 18 1 19 2012-09-19 Nate Chapin <japhet@chromium.org> 2 20 -
trunk/Source/WebCore/ChangeLog
r129016 r129018 1 2012-09-18 Dirk Schulze <krit@webkit.org> 2 3 Implement 'mask-type' for <mask> 4 https://bugs.webkit.org/show_bug.cgi?id=97011 5 6 Reviewed by Andreas Kling. 7 8 The CSS Masking specification defines the presentation attribute 'mask-type' to 9 switch between luminance and alpha masking. 'mask-type' just affects the SVG 10 mask element. The luminance masking is the current behavior of of SVG masking. 11 Alpha masking is simular to '-webkit-mask-image'. 12 13 This patch implements this property and make it possible to switch between both 14 masking modes. Since the default value is 'luminance', this does not break 15 exisiting content which is tested with exisiting tests. 16 17 http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#the-mask-type 18 19 Tests: svg/css/mask-type.html 20 svg/masking/mask-type-alpha-expected.svg 21 svg/masking/mask-type-alpha.svg 22 svg/masking/mask-type-luminance-expected.svg 23 svg/masking/mask-type-luminance.svg 24 svg/masking/mask-type-not-set-expected.svg 25 svg/masking/mask-type-not-set.svg 26 27 * css/CSSComputedStyleDeclaration.cpp: Add mask-type property. 28 (WebCore): 29 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 30 * css/CSSPrimitiveValueMappings.h: 31 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 32 (WebCore): 33 (WebCore::CSSPrimitiveValue::operator EMaskType): 34 * css/CSSProperty.cpp: 35 (WebCore::CSSProperty::isInheritedProperty): 36 * css/SVGCSSComputedStyleDeclaration.cpp: 37 (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): 38 * css/SVGCSSParser.cpp: 39 (WebCore::CSSParser::parseSVGValue): 40 * css/SVGCSSPropertyNames.in: Add mask-type. 41 * css/SVGCSSStyleSelector.cpp: 42 (WebCore::StyleResolver::applySVGProperty): 43 * css/SVGCSSValueKeywords.in: 44 * rendering/style/SVGRenderStyle.cpp: 45 (WebCore::SVGRenderStyle::diff): 46 * rendering/style/SVGRenderStyle.h: 47 (WebCore::SVGRenderStyle::initialMaskType): 48 (WebCore::SVGRenderStyle::setMaskType): 49 (SVGRenderStyle): 50 (WebCore::SVGRenderStyle::maskType): 51 (WebCore::SVGRenderStyle::setBitDefaults): 52 * rendering/style/SVGRenderStyleDefs.h: 53 * rendering/svg/RenderSVGResourceMasker.cpp: 54 55 Switch between the two masking modes according to the 56 computed value of mask-type. 57 58 (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): 59 * svg/SVGStyledElement.cpp: 60 (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName): 61 (WebCore::cssPropertyToTypeMap): 62 * svg/svgattrs.in: Add the new attribute to the attribute list. 63 1 64 2012-09-19 Mark Pilgrim <pilgrim@chromium.org> 2 65 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r128762 r129018 378 378 CSSPropertyMarkerMid, 379 379 CSSPropertyMarkerStart, 380 CSSPropertyMaskType, 380 381 CSSPropertyShapeRendering, 381 382 CSSPropertyStroke, … … 2614 2615 case CSSPropertyMarkerMid: 2615 2616 case CSSPropertyMarkerStart: 2617 case CSSPropertyMaskType: 2616 2618 case CSSPropertyShapeRendering: 2617 2619 case CSSPropertyStroke: -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r127737 r129018 4278 4278 } 4279 4279 4280 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMaskType e) 4281 : CSSValue(PrimitiveClass) 4282 { 4283 m_primitiveUnitType = CSS_IDENT; 4284 switch (e) { 4285 case MT_LUMINANCE: 4286 m_value.ident = CSSValueLuminance; 4287 break; 4288 case MT_ALPHA: 4289 m_value.ident = CSSValueAlpha; 4290 break; 4291 } 4292 } 4293 4294 template<> inline CSSPrimitiveValue::operator EMaskType() const 4295 { 4296 switch (m_value.ident) { 4297 case CSSValueLuminance: 4298 return MT_LUMINANCE; 4299 case CSSValueAlpha: 4300 return MT_ALPHA; 4301 } 4302 4303 ASSERT_NOT_REACHED(); 4304 return MT_LUMINANCE; 4305 } 4306 4280 4307 #endif // ENABLE(SVG) 4281 4308 -
trunk/Source/WebCore/css/CSSProperty.cpp
r128762 r129018 684 684 case CSSPropertyClipPath: 685 685 case CSSPropertyMask: 686 case CSSPropertyMaskType: 686 687 case CSSPropertyEnableBackground: 687 688 case CSSPropertyFilter: -
trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
r113748 r129018 193 193 case CSSPropertyVectorEffect: 194 194 return CSSPrimitiveValue::create(svgStyle->vectorEffect()); 195 case CSSPropertyMaskType: 196 return CSSPrimitiveValue::create(svgStyle->maskType()); 195 197 case CSSPropertyMarker: 196 198 case CSSPropertyEnableBackground: -
trunk/Source/WebCore/css/SVGCSSParser.cpp
r125252 r129018 271 271 } 272 272 273 case CSSPropertyMaskType: // luminance | alpha | inherit 274 if (id == CSSValueLuminance || id == CSSValueAlpha) 275 valid_primitive = true; 276 break; 277 273 278 /* shorthand properties */ 274 279 case CSSPropertyMarker: -
trunk/Source/WebCore/css/SVGCSSPropertyNames.in
r119708 r129018 31 31 marker-mid 32 32 marker-start 33 mask-type 33 34 shape-rendering 34 35 stroke -
trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp
r121289 r129018 583 583 break; 584 584 } 585 case CSSPropertyMaskType: { 586 HANDLE_INHERIT_AND_INITIAL(maskType, MaskType) 587 if (!primitiveValue) 588 break; 589 590 svgstyle->setMaskType(*primitiveValue); 591 break; 592 } 585 593 default: 586 594 // If you crash here, it's because you added a css property and are not handling it -
trunk/Source/WebCore/css/SVGCSSValueKeywords.in
r106980 r129018 5 5 // 6 6 aliceblue 7 alpha 7 8 antiquewhite 8 9 // aqua … … 89 90 limegreen 90 91 linen 92 luminance 91 93 magenta 92 94 // maroon -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.cpp
r98542 r129018 224 224 return StyleDifferenceRepaint; 225 225 226 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.maskType) 227 return StyleDifferenceRepaint; 228 226 229 return StyleDifferenceEqual; 227 230 } -
trunk/Source/WebCore/rendering/style/SVGRenderStyle.h
r115201 r129018 93 93 static String initialMarkerMidResource() { return String(); } 94 94 static String initialMarkerEndResource() { return String(); } 95 static EMaskType initialMaskType() { return MT_LUMINANCE; } 95 96 96 97 static SVGLength initialBaselineShiftValue() … … 147 148 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationHorizontal = val; } 148 149 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; } 149 150 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 151 150 152 void setFillOpacity(float obj) 151 153 { … … 349 351 String markerMidResource() const { return inheritedResources->markerMid; } 350 352 String markerEndResource() const { return inheritedResources->markerEnd; } 351 353 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.maskType; } 354 352 355 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedLinkPaintType; } 353 356 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPaintColor; } … … 417 420 unsigned _baselineShift : 2; // EBaselineShift 418 421 unsigned _vectorEffect: 1; // EVectorEffect 419 // 21 bits unused 422 unsigned maskType: 1; // EMaskType 423 // 20 bits unused 420 424 } f; 421 425 uint32_t _niflags; … … 462 466 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 463 467 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 468 svg_noninherited_flags.f.maskType = initialMaskType(); 464 469 } 465 470 }; -
trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
r97638 r129018 84 84 }; 85 85 86 enum EMaskType { 87 MT_LUMINANCE, 88 MT_ALPHA 89 }; 90 86 91 class CSSValue; 87 92 class CSSValueList; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp
r115248 r129018 154 154 #endif 155 155 156 ASSERT(style()); 157 ASSERT(style()->svgStyle()); 156 158 // Create the luminance mask. 157 maskerData->maskImage->convertToLuminanceMask(); 159 if (style()->svgStyle()->maskType() == MT_LUMINANCE) 160 maskerData->maskImage->convertToLuminanceMask(); 161 158 162 return true; 159 163 } -
trunk/Source/WebCore/svg/SVGStyledElement.cpp
r127757 r129018 182 182 mapAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr); 183 183 mapAttributeToCSSProperty(propertyNameToIdMap, maskAttr); 184 mapAttributeToCSSProperty(propertyNameToIdMap, mask_typeAttr); 184 185 mapAttributeToCSSProperty(propertyNameToIdMap, opacityAttr); 185 186 mapAttributeToCSSProperty(propertyNameToIdMap, overflowAttr); … … 252 253 s_cssPropertyMap.set(marker_startAttr, AnimatedString); 253 254 s_cssPropertyMap.set(maskAttr, AnimatedString); 255 s_cssPropertyMap.set(mask_typeAttr, AnimatedString); 254 256 s_cssPropertyMap.set(opacityAttr, AnimatedNumber); 255 257 s_cssPropertyMap.set(overflowAttr, AnimatedString); -
trunk/Source/WebCore/svg/svgattrs.in
r109916 r129018 116 116 markerWidth 117 117 mask 118 mask-type 118 119 maskContentUnits 119 120 maskUnits
Note: See TracChangeset
for help on using the changeset viewer.