Changeset 127327 in webkit
- Timestamp:
- Aug 31, 2012 3:29:48 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127324 r127327 1 2012-08-30 Dirk Schulze <krit@webkit.org> 2 3 Introduce new CSS property for clip-path 4 https://bugs.webkit.org/show_bug.cgi?id=95474 5 6 Reviewed by Tim Horton. 7 8 Test parsing behavior of basic shapes on new introduced '-webkit-clip-path' CSS property. 9 10 * fast/masking/parsing-clip-path-shape-expected.txt: Added. 11 * fast/masking/parsing-clip-path-shape.html: Added. 12 1 13 2012-08-31 Geoffrey Garen <ggaren@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r127325 r127327 1 2012-08-30 Dirk Schulze <krit@webkit.org> 2 3 Introduce new CSS property for clip-path 4 https://bugs.webkit.org/show_bug.cgi?id=95474 5 6 Reviewed by Tim Horton. 7 8 This path introduces the new, prefixed CSS property 'clip-path' from the 9 CSS Masking specification. In a first step the property just accepts 10 'none' and the the basic shapes from CSS Exclusion. Later it will also be 11 possible to reference SVG 'clipPath' elements - like Firefox already does. 12 To enable the parsing of the shapes, the exclusion compiler flags 13 around the shape parser were removed. 14 15 http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html 16 17 Test: fast/masking/parsing-clip-path-shape.html 18 19 * css/CSSComputedStyleDeclaration.cpp: 20 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Return CSSValue for CSSPropertyWebkitClipPath. 21 * css/CSSParser.cpp: 22 (WebCore::CSSParser::parseValue): Add CSSPropertyWebkitClipPath. 23 (WebCore::CSSParser::parseBasicShape): Modify parser function to accept CSSPropertyWebkitClipPath as well. 24 * css/CSSParser.h: 25 * css/CSSProperty.cpp: 26 (WebCore::CSSProperty::isInheritedProperty): 27 * css/CSSPropertyNames.in: Added property name -webkit-clip-path. 28 * css/StyleBuilder.cpp: 29 (ApplyPropertyClipPath): New property applier just for -webkit-clip-path. 30 (WebCore::ApplyPropertyClipPath::setValue): 31 (WebCore::ApplyPropertyClipPath::applyValue): 32 (WebCore::ApplyPropertyClipPath::createHandler): 33 (WebCore::StyleBuilder::StyleBuilder): 34 * rendering/style/RenderStyle.cpp: Repaint if there is a difference between two BasicShapes. 35 (WebCore::RenderStyle::diff): 36 * rendering/style/RenderStyle.h: 37 * rendering/style/StyleRareNonInheritedData.cpp: 38 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 39 (WebCore::StyleRareNonInheritedData::operator==): 40 (WebCore::StyleRareNonInheritedData::reportMemoryUsage): 41 * rendering/style/StyleRareNonInheritedData.h: Add new member variable for clip shape. 42 (StyleRareNonInheritedData): 43 1 44 2012-08-31 Joshua Netterfield <jnetterfield@rim.com> 2 45 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r127318 r127327 26 26 27 27 #include "AnimationController.h" 28 #include "BasicShapeFunctions.h" 29 #include "BasicShapes.h" 28 30 #include "CSSAspectRatioValue.h" 31 #include "CSSBasicShapes.h" 29 32 #include "CSSBorderImage.h" 30 33 #include "CSSLineBoxContainValue.h" … … 60 63 #include "WebKitFontFamilyNames.h" 61 64 #include <wtf/text/StringBuilder.h> 62 63 #if ENABLE(CSS_EXCLUSIONS)64 #include "BasicShapeFunctions.h"65 #include "BasicShapes.h"66 #include "CSSBasicShapes.h"67 #endif68 65 69 66 #if ENABLE(CSS_SHADERS) … … 236 233 CSSPropertyWebkitBoxReflect, 237 234 CSSPropertyWebkitBoxShadow, 235 CSSPropertyWebkitClipPath, 238 236 CSSPropertyWebkitColorCorrection, 239 237 CSSPropertyWebkitColumnBreakAfter, … … 2404 2402 case CSSPropertyCounterReset: 2405 2403 return counterToCSSValue(style.get(), propertyID); 2404 case CSSPropertyWebkitClipPath: 2405 if (!style->clipPath()) 2406 return cssValuePool().createIdentifierValue(CSSValueNone); 2407 return valueForBasicShape(style->clipPath()); 2406 2408 #if ENABLE(CSS_REGIONS) 2407 2409 case CSSPropertyWebkitFlowInto: -
trunk/Source/WebCore/css/CSSParser.cpp
r127318 r127327 2744 2744 return parseFontVariantLigatures(important); 2745 2745 break; 2746 case CSSPropertyWebkitClipPath: 2747 if (id == CSSValueNone) 2748 validPrimitive = true; 2749 else if (value->unit == CSSParserValue::Function) 2750 return parseBasicShape(propId, important); 2751 break; 2746 2752 #if ENABLE(CSS_EXCLUSIONS) 2747 2753 case CSSPropertyWebkitShapeInside: … … 2752 2758 validPrimitive = true; 2753 2759 else if (value->unit == CSSParserValue::Function) 2754 return parseBasicShape( (propId == CSSPropertyWebkitShapeInside), important);2760 return parseBasicShape(propId, important); 2755 2761 break; 2756 2762 case CSSPropertyWebkitWrapMargin: … … 4536 4542 } 4537 4543 4538 #if ENABLE(CSS_EXCLUSIONS)4539 4540 4544 PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeRectangle(CSSParserValueList* args) 4541 4545 { … … 4748 4752 } 4749 4753 4750 bool CSSParser::parseBasicShape( bool shapeInside, bool important)4754 bool CSSParser::parseBasicShape(CSSPropertyID propId, bool important) 4751 4755 { 4752 4756 CSSParserValue* value = m_valueList->current(); 4757 ASSERT(value->unit == CSSParserValue::Function); 4753 4758 CSSParserValueList* args = value->function->args.get(); 4754 4759 … … 4757 4762 4758 4763 RefPtr<CSSBasicShape> shape; 4759 4760 4764 if (equalIgnoringCase(value->function->name, "rectangle(")) 4761 4765 shape = parseBasicShapeRectangle(args); … … 4767 4771 shape = parseBasicShapePolygon(args); 4768 4772 4769 if (shape) { 4770 addProperty(shapeInside ? CSSPropertyWebkitShapeInside : CSSPropertyWebkitShapeOutside, cssValuePool().createValue(shape.release()), important); 4771 m_valueList->next(); 4772 return true; 4773 } 4774 4775 return false; 4776 } 4777 4778 #endif 4773 if (!shape) 4774 return false; 4775 4776 addProperty(propId, cssValuePool().createValue(shape.release()), important); 4777 m_valueList->next(); 4778 return true; 4779 } 4779 4780 4780 4781 // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family' -
trunk/Source/WebCore/css/CSSParser.h
r127277 r127327 151 151 bool parseClipShape(CSSPropertyID, bool important); 152 152 153 bool parseBasicShape( bool shapeInside, bool important);153 bool parseBasicShape(CSSPropertyID, bool important); 154 154 PassRefPtr<CSSBasicShape> parseBasicShapeRectangle(CSSParserValueList* args); 155 155 PassRefPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueList* args); -
trunk/Source/WebCore/css/CSSProperty.cpp
r127318 r127327 562 562 case CSSPropertyWebkitBoxReflect: 563 563 case CSSPropertyWebkitBoxShadow: 564 case CSSPropertyWebkitClipPath: 564 565 case CSSPropertyWebkitColumnAxis: 565 566 case CSSPropertyWebkitColumnBreakAfter: -
trunk/Source/WebCore/css/CSSPropertyNames.in
r127318 r127327 96 96 clear 97 97 clip 98 -webkit-clip-path 98 99 content 99 100 counter-increment -
trunk/Source/WebCore/css/StyleBuilder.cpp
r127318 r127327 1702 1702 { 1703 1703 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); 1704 } 1705 }; 1706 1707 template <BasicShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<BasicShape>), BasicShape* (*initialFunction)()> 1708 class ApplyPropertyClipPath { 1709 public: 1710 static void setValue(RenderStyle* style, PassRefPtr<BasicShape> value) { (style->*setterFunction)(value); } 1711 static void applyValue(StyleResolver* styleResolver, CSSValue* value) 1712 { 1713 if (value->isPrimitiveValue()) { 1714 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 1715 if (primitiveValue->getIdent() == CSSValueNone) 1716 setValue(styleResolver->style(), 0); 1717 else if (primitiveValue->isShape()) { 1718 RefPtr<BasicShape> clipPathShape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue()); 1719 setValue(styleResolver->style(), clipPathShape.release()); 1720 } 1721 } 1722 } 1723 static PropertyHandler createHandler() 1724 { 1725 PropertyHandler handler = ApplyPropertyDefaultBase<BasicShape*, getterFunction, PassRefPtr<BasicShape>, setterFunction, BasicShape*, initialFunction>::createHandler(); 1726 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1704 1727 } 1705 1728 }; … … 2049 2072 setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler()); 2050 2073 setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler()); 2074 setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler()); 2075 2051 2076 #if ENABLE(CSS_EXCLUSIONS) 2052 2077 setPropertyHandler(CSSPropertyWebkitWrap, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitWrapFlow, CSSPropertyWebkitWrapMargin, CSSPropertyWebkitWrapPadding>::createHandler()); -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r127112 r127327 681 681 if (rareNonInheritedData->m_wrapShapeOutside != other->rareNonInheritedData->m_wrapShapeOutside) 682 682 return StyleDifferenceRepaint; 683 684 if (rareNonInheritedData->m_clipPath != other->rareNonInheritedData->m_clipPath) 685 return StyleDifferenceRepaint; 686 683 687 684 688 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r127318 r127327 1464 1464 static BasicShape* initialWrapShapeInside() { return 0; } 1465 1465 static BasicShape* initialWrapShapeOutside() { return 0; } 1466 1467 void setClipPath(PassRefPtr<BasicShape> shape) 1468 { 1469 if (rareNonInheritedData->m_clipPath != shape) 1470 rareNonInheritedData.access()->m_clipPath = shape; 1471 } 1472 BasicShape* clipPath() const { return rareNonInheritedData->m_clipPath.get(); } 1473 1474 static BasicShape* initialClipPath() { return 0; } 1466 1475 1467 1476 Length wrapPadding() const { return rareNonInheritedData->m_wrapPadding; } -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r126154 r127327 49 49 , m_wrapMargin(RenderStyle::initialWrapMargin()) 50 50 , m_wrapPadding(RenderStyle::initialWrapPadding()) 51 , m_clipPath(RenderStyle::initialClipPath()) 51 52 , m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor()) 52 53 , m_order(RenderStyle::initialOrder()) … … 119 120 , m_wrapMargin(o.m_wrapMargin) 120 121 , m_wrapPadding(o.m_wrapPadding) 122 , m_clipPath(o.m_clipPath) 121 123 , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor) 122 124 , m_visitedLinkOutlineColor(o.m_visitedLinkOutlineColor) … … 200 202 && m_wrapMargin == o.m_wrapMargin 201 203 && m_wrapPadding == o.m_wrapPadding 204 && m_clipPath == o.m_clipPath 202 205 && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor 203 206 && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor … … 324 327 info.addMember(m_wrapShapeInside); 325 328 info.addMember(m_wrapShapeOutside); 329 info.addMember(m_clipPath); 326 330 info.addInstrumentedMember(m_flowThread); 327 331 info.addInstrumentedMember(m_regionThread); -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r127155 r127327 139 139 Length m_wrapMargin; 140 140 Length m_wrapPadding; 141 141 142 RefPtr<BasicShape> m_clipPath; 143 142 144 Color m_visitedLinkBackgroundColor; 143 145 Color m_visitedLinkOutlineColor;
Note: See TracChangeset
for help on using the changeset viewer.