Changeset 128700 in webkit
- Timestamp:
- Sep 15, 2012 9:24:24 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128697 r128700 1 2012-09-11 Dirk Schulze <krit@webkit.org> 2 3 Add ClipPathOperation for -webkit-clip-path organization 4 https://bugs.webkit.org/show_bug.cgi?id=95619 5 6 Reviewed by Dean Jackson. 7 8 This patch adds a new class ClipPathOperation to manage the values of the 9 -webkit-clip-path property. ClipPathOperation stores a Path object for clipping and is 10 a preparation for IRI references of the SVG 'clipPath' element. 11 12 The structure of ClipPathOperation is simular to FilterOperation. 13 14 ClipPathOperation will be extended to support IRI references directly in a second patch. 15 16 No new tests. The changes just affect the backend. 17 18 * GNUmakefile.list.am: Added new ClipPathOperation class. 19 * WebCore.gypi: Ditto. 20 * WebCore.vcproj/WebCore.vcproj: Ditto. 21 * WebCore.xcodeproj/project.pbxproj: Ditto. 22 * css/CSSComputedStyleDeclaration.cpp: Use ClipPathOperation instead of BasicShape. 23 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Ditto. 24 * css/StyleBuilder.cpp: Ditto. 25 (WebCore): 26 (WebCore::ApplyPropertyClipPath::setValue): 27 (WebCore::ApplyPropertyClipPath::applyValue): 28 (WebCore::ApplyPropertyClipPath::createHandler): 29 * rendering/ClipPathOperation.h: Added. New handler for property values (BasicShape, references). 30 (WebCore): 31 (ClipPathOperation): 32 (WebCore::ClipPathOperation::~ClipPathOperation): 33 (WebCore::ClipPathOperation::operator!=): 34 (WebCore::ClipPathOperation::getOperationType): Return the operation type. 35 (WebCore::ClipPathOperation::isSameType): Helper function for =operator. 36 (WebCore::ClipPathOperation::ClipPathOperation): 37 (ShapeClipPathOperation): Inheriting class for managing BasicShapes. 38 (WebCore::ShapeClipPathOperation::create): 39 (WebCore::ShapeClipPathOperation::basicShape): 40 (WebCore::ShapeClipPathOperation::windRule): 41 (WebCore::ShapeClipPathOperation::path): 42 (WebCore::ShapeClipPathOperation::operator==): 43 (WebCore::ShapeClipPathOperation::ShapeClipPathOperation): 44 * rendering/RenderLayer.cpp: Use ClipPathOperation to apply clipping. 45 (WebCore::RenderLayer::paintLayerContents): 46 * rendering/style/RenderStyle.h: 47 * rendering/style/StyleRareNonInheritedData.h: 48 (StyleRareNonInheritedData): 49 * rendering/svg/SVGRenderingContext.cpp: Ditto. 50 (WebCore::SVGRenderingContext::prepareToRenderSVGContent): 51 1 52 2012-09-15 Andreas Kling <kling@webkit.org> 2 53 -
trunk/Source/WebCore/GNUmakefile.list.am
r128696 r128700 5118 5118 Source/WebCore/rendering/style/BorderData.h \ 5119 5119 Source/WebCore/rendering/style/BorderValue.h \ 5120 Source/WebCore/rendering/style/ClipPathOperation.h \ 5120 5121 Source/WebCore/rendering/style/CollapsedBorderValue.h \ 5121 5122 Source/WebCore/rendering/style/ContentData.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r128626 r128700 592 592 'rendering/style/BorderData.h', 593 593 'rendering/style/BorderValue.h', 594 'rendering/style/ClipPathOperation.h', 594 595 'rendering/style/CollapsedBorderValue.h', 595 596 'rendering/style/ContentData.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r128626 r128700 46688 46688 > 46689 46689 </File> 46690 <File 46691 RelativePath="..\rendering\style\ClipPathOperation.h" 46692 > 46693 </File> 46690 46694 </Filter> 46691 46695 <Filter -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r128626 r128700 6317 6317 FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72FC1059C21100D999DD /* MathMLNames.cpp */; }; 6318 6318 FB78AD2E151BF5E600FE54D3 /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6319 FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = FB92DF4915FED08700994433 /* ClipPathOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6319 6320 FBC220DF1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */; }; 6320 6321 FBD6AF8815EF25C9008B7110 /* CSSBasicShapes.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD6AF8715EF21D4008B7110 /* CSSBasicShapes.h */; }; … … 13733 13734 FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; }; 13734 13735 FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSParserMode.h; sourceTree = "<group>"; }; 13736 FB92DF4915FED08700994433 /* ClipPathOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipPathOperation.h; sourceTree = "<group>"; }; 13735 13737 FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DOpenGL.cpp; sourceTree = "<group>"; }; 13736 13738 FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BasicShapes.cpp; path = style/BasicShapes.cpp; sourceTree = "<group>"; }; … … 20467 20469 BC5EB5E00E81BE8700B25965 /* BorderData.h */, 20468 20470 BC5EB5DA0E81B7EA00B25965 /* BorderValue.h */, 20471 FB92DF4915FED08700994433 /* ClipPathOperation.h */, 20469 20472 BC5EB5DE0E81B9AB00B25965 /* CollapsedBorderValue.h */, 20470 20473 BC5EB97E0E82072500B25965 /* ContentData.cpp */, … … 25559 25562 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, 25560 25563 FD537353137B651800008DCE /* ZeroPole.h in Headers */, 25564 FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */, 25561 25565 4F7B4A6615FF6D6A006B5F22 /* PlatformMemoryInstrumentation.h in Headers */, 25562 25566 ); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r128626 r128700 2418 2418 return counterToCSSValue(style.get(), propertyID); 2419 2419 case CSSPropertyWebkitClipPath: 2420 if (!style->clipPath()) 2421 return cssValuePool().createIdentifierValue(CSSValueNone); 2422 return valueForBasicShape(style->clipPath()); 2420 if (ClipPathOperation* operation = style->clipPath()) { 2421 if (operation->getOperationType() == ClipPathOperation::SHAPE) 2422 return valueForBasicShape(static_cast<ShapeClipPathOperation*>(operation)->basicShape()); 2423 } 2424 return cssValuePool().createIdentifierValue(CSSValueNone); 2423 2425 #if ENABLE(CSS_REGIONS) 2424 2426 case CSSPropertyWebkitFlowInto: -
trunk/Source/WebCore/css/StyleBuilder.cpp
r128660 r128700 34 34 #include "CSSToStyleMap.h" 35 35 #include "CSSValueList.h" 36 #include "ClipPathOperation.h" 36 37 #include "CursorList.h" 37 38 #include "Document.h" … … 1685 1686 }; 1686 1687 1687 template < BasicShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<BasicShape>), BasicShape* (*initialFunction)()>1688 template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()> 1688 1689 class ApplyPropertyClipPath { 1689 1690 public: 1690 static void setValue(RenderStyle* style, PassRefPtr< BasicShape> value) { (style->*setterFunction)(value); }1691 static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); } 1691 1692 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) 1692 1693 { … … 1696 1697 setValue(styleResolver->style(), 0); 1697 1698 else if (primitiveValue->isShape()) { 1698 RefPtr<BasicShape> clipPathShape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue()); 1699 setValue(styleResolver->style(), clipPathShape.release()); 1699 setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()))); 1700 1700 } 1701 1701 } … … 1703 1703 static PropertyHandler createHandler() 1704 1704 { 1705 PropertyHandler handler = ApplyPropertyDefaultBase< BasicShape*, getterFunction, PassRefPtr<BasicShape>, setterFunction, BasicShape*, initialFunction>::createHandler();1705 PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler(); 1706 1706 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1707 1707 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r128677 r128700 3117 3117 RenderStyle* style = renderer()->style(); 3118 3118 if (renderer()->hasClipPath() && !context->paintingDisabled() && style) { 3119 if (BasicShape* clipShape = style->clipPath()) { 3120 // FIXME: Investigate if it is better to store and update a Path object in RenderStyle. 3121 // https://bugs.webkit.org/show_bug.cgi?id=95619 3122 Path clipPath; 3123 clipShape->path(clipPath, calculateLayerBounds(this, rootLayer, 0)); 3124 transparencyLayerContext->clipPath(clipPath, clipShape->windRule()); 3119 ASSERT(style->clipPath()); 3120 if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) { 3121 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(style->clipPath()); 3122 transparencyLayerContext->clipPath(clipPath->path(calculateLayerBounds(this, rootLayer, 0)), clipPath->windRule()); 3125 3123 } 3126 3124 } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r128508 r128700 1463 1463 static BasicShape* initialWrapShapeOutside() { return 0; } 1464 1464 1465 void setClipPath(PassRefPtr< BasicShape> shape)1466 { 1467 if (rareNonInheritedData->m_clipPath != shape)1468 rareNonInheritedData.access()->m_clipPath = shape;1469 } 1470 BasicShape* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }1471 1472 static BasicShape* initialClipPath() { return 0; }1465 void setClipPath(PassRefPtr<ClipPathOperation> operation) 1466 { 1467 if (rareNonInheritedData->m_clipPath != operation) 1468 rareNonInheritedData.access()->m_clipPath = operation; 1469 } 1470 ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); } 1471 1472 static ClipPathOperation* initialClipPath() { return 0; } 1473 1473 1474 1474 Length wrapPadding() const { return rareNonInheritedData->m_wrapPadding; } -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r128418 r128700 27 27 28 28 #include "BasicShapes.h" 29 #include "ClipPathOperation.h" 29 30 #include "CounterDirectives.h" 30 31 #include "CursorData.h" … … 139 140 Length m_wrapPadding; 140 141 141 RefPtr< BasicShape> m_clipPath;142 RefPtr<ClipPathOperation> m_clipPath; 142 143 143 144 Color m_visitedLinkBackgroundColor; -
trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
r127383 r128700 124 124 } 125 125 126 BasicShape* clipShape = style->clipPath(); 127 if (clipShape) { 128 // FIXME: Investigate if it is better to store and update a Path object in RenderStyle. 129 // https://bugs.webkit.org/show_bug.cgi?id=95619 130 Path clipPath; 131 clipShape->path(clipPath, object->objectBoundingBox()); 132 m_paintInfo->context->clipPath(clipPath, clipShape->windRule()); 126 ClipPathOperation* clipPathOperation = style->clipPath(); 127 if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOperation::SHAPE) { 128 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation); 129 m_paintInfo->context->clipPath(clipPath->path(object->objectBoundingBox()), clipPath->windRule()); 133 130 } 134 131 … … 151 148 152 149 RenderSVGResourceClipper* clipper = resources->clipper(); 153 if (!clip Shape&& clipper) {150 if (!clipPathOperation && clipper) { 154 151 if (!clipper->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode)) 155 152 return;
Note: See TracChangeset
for help on using the changeset viewer.