Changeset 163764 in webkit
- Timestamp:
- Feb 9, 2014 10:02:42 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r163749 r163764 1 2014-02-09 Dirk Schulze <krit@webkit.org> 2 3 -webkit-clip-path should support fill, stroke, view-box keywords 4 https://bugs.webkit.org/show_bug.cgi?id=128393 5 6 Reviewed by Dean Jackson. 7 8 Update or add new tests for changed clip-path keywords. 9 10 * css3/masking/clip-path-circle-bounding-box.html: Removed. 11 * fast/masking/parsing-clip-path-shape.html: 12 * platform/mac/css3/masking/clip-path-circle-bounding-box-expected.png: Removed. 13 * platform/mac/css3/masking/clip-path-circle-bounding-box-expected.txt: Removed. 14 * svg/clip-path/clip-path-shape-fill-expected.svg: Added. 15 * svg/clip-path/clip-path-shape-fill.svg: Added. 16 * svg/clip-path/clip-path-shape-stroke-expected.svg: Added. 17 * svg/clip-path/clip-path-shape-stroke.svg: Added. 18 * svg/clip-path/clip-path-shape-view-box-expected.svg: Added. 19 * svg/clip-path/clip-path-shape-view-box.svg: Added. 20 1 21 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 22 -
trunk/LayoutTests/fast/masking/parsing-clip-path-shape-expected.txt
r161209 r163764 53 53 PASS innerStyle("-webkit-clip-path", "border-box") is "border-box" 54 54 PASS innerStyle("-webkit-clip-path", "margin-box") is "margin-box" 55 PASS innerStyle("-webkit-clip-path", "bounding-box") is "bounding-box" 55 PASS innerStyle("-webkit-clip-path", "fill") is "fill" 56 PASS innerStyle("-webkit-clip-path", "stroke") is "stroke" 57 PASS innerStyle("-webkit-clip-path", "view-box") is "view-box" 56 58 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box") is "circle(50% at 50% 50%) content-box" 57 59 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) padding-box") is "circle(50% at 50% 50%) padding-box" 58 60 PASS innerStyle("-webkit-clip-path", "margin-box circle(50% at 50% 50%)") is "margin-box circle(50% at 50% 50%)" 59 61 PASS innerStyle("-webkit-clip-path", "border-box circle(50% at 50% 50%)") is "border-box circle(50% at 50% 50%)" 60 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box") is "circle(50% at 50% 50%) bounding-box"62 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) view-box") is "circle(50% at 50% 50%) view-box" 61 63 PASS computedStyle("-webkit-clip-path", "content-box") is "content-box" 62 64 PASS computedStyle("-webkit-clip-path", "padding-box") is "padding-box" 63 65 PASS computedStyle("-webkit-clip-path", "border-box") is "border-box" 64 66 PASS computedStyle("-webkit-clip-path", "margin-box") is "margin-box" 65 PASS computedStyle("-webkit-clip-path", "bounding-box") is "bounding-box" 67 PASS computedStyle("-webkit-clip-path", "fill") is "fill" 68 PASS computedStyle("-webkit-clip-path", "stroke") is "stroke" 69 PASS computedStyle("-webkit-clip-path", "view-box") is "view-box" 66 70 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box") is "circle(50% at 50% 50%) content-box" 67 71 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) padding-box") is "circle(50% at 50% 50%) padding-box" 68 72 PASS computedStyle("-webkit-clip-path", "margin-box circle(50% at 50% 50%)") is "circle(50% at 50% 50%) margin-box" 69 73 PASS computedStyle("-webkit-clip-path", "border-box circle(50% at 50% 50%)") is "circle(50% at 50% 50%) border-box" 70 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box") is "circle(50% at 50% 50%) bounding-box"74 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) fill") is "circle(50% at 50% 50%) fill" 71 75 PASS innerStyle("-webkit-clip-path", "circle(1px, 1px, 1)") is null 72 76 PASS computedStyle("-webkit-clip-path", "circle(1px, 1px, 1)") is "none" … … 101 105 PASS innerStyle("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is null 102 106 PASS computedStyle("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is "none" 103 PASS innerStyle("-webkit-clip-path", " bounding-boxcircle(50% at 50% 50%) content-box") is null104 PASS computedStyle("-webkit-clip-path", " bounding-boxcircle(50% at 50% 50%) content-box") is "none"107 PASS innerStyle("-webkit-clip-path", "fill circle(50% at 50% 50%) content-box") is null 108 PASS computedStyle("-webkit-clip-path", "fill circle(50% at 50% 50%) content-box") is "none" 105 109 PASS innerStyle("-webkit-clip-path", "margin-box padding-box") is null 106 110 PASS computedStyle("-webkit-clip-path", "margin-box padding-box") is "none" 107 111 PASS innerStyle("-webkit-clip-path", "padding-box border-box circle(50% at 50% 50%)") is null 108 112 PASS computedStyle("-webkit-clip-path", "padding-box border-box circle(50% at 50% 50%)") is "none" 109 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box bounding-box") is null110 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box bounding-box") is "none"113 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box stroke") is null 114 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box stroke") is "none" 111 115 PASS innerStyle("-webkit-clip-path", "content-box margin-box padding-box") is null 112 116 PASS computedStyle("-webkit-clip-path", "content-box margin-box padding-box") is "none" -
trunk/LayoutTests/fast/masking/parsing-clip-path-shape.html
r161209 r163764 112 112 testInner("-webkit-clip-path", "border-box", "border-box"); 113 113 testInner("-webkit-clip-path", "margin-box", "margin-box"); 114 testInner("-webkit-clip-path", "bounding-box", "bounding-box"); 114 testInner("-webkit-clip-path", "fill", "fill"); 115 testInner("-webkit-clip-path", "stroke", "stroke"); 116 testInner("-webkit-clip-path", "view-box", "view-box"); 115 117 testInner("-webkit-clip-path", "circle(50% at 50% 50%) content-box", "circle(50% at 50% 50%) content-box"); 116 118 testInner("-webkit-clip-path", "circle(50% at 50% 50%) padding-box", "circle(50% at 50% 50%) padding-box"); 117 119 testInner("-webkit-clip-path", "margin-box circle(50% at 50% 50%)", "margin-box circle(50% at 50% 50%)"); 118 120 testInner("-webkit-clip-path", "border-box circle(50% at 50% 50%)", "border-box circle(50% at 50% 50%)"); 119 testInner("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box", "circle(50% at 50% 50%) bounding-box");121 testInner("-webkit-clip-path", "circle(50% at 50% 50%) view-box", "circle(50% at 50% 50%) view-box"); 120 122 121 123 testComputed("-webkit-clip-path", "content-box", "content-box"); … … 123 125 testComputed("-webkit-clip-path", "border-box", "border-box"); 124 126 testComputed("-webkit-clip-path", "margin-box", "margin-box"); 125 testComputed("-webkit-clip-path", "bounding-box", "bounding-box"); 127 testComputed("-webkit-clip-path", "fill", "fill"); 128 testComputed("-webkit-clip-path", "stroke", "stroke"); 129 testComputed("-webkit-clip-path", "view-box", "view-box"); 126 130 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) content-box", "circle(50% at 50% 50%) content-box"); 127 131 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) padding-box", "circle(50% at 50% 50%) padding-box"); 128 132 testComputed("-webkit-clip-path", "margin-box circle(50% at 50% 50%)", "circle(50% at 50% 50%) margin-box"); 129 133 testComputed("-webkit-clip-path", "border-box circle(50% at 50% 50%)", "circle(50% at 50% 50%) border-box"); 130 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box", "circle(50% at 50% 50%) bounding-box");134 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) fill", "circle(50% at 50% 50%) fill"); 131 135 132 136 // reject non-lengths … … 154 158 155 159 // reject multiple <box> values 156 negativeTest("-webkit-clip-path", " bounding-boxcircle(50% at 50% 50%) content-box");160 negativeTest("-webkit-clip-path", "fill circle(50% at 50% 50%) content-box"); 157 161 negativeTest("-webkit-clip-path", "margin-box padding-box"); 158 162 negativeTest("-webkit-clip-path", "padding-box border-box circle(50% at 50% 50%)"); 159 negativeTest("-webkit-clip-path", "circle(50% at 50% 50%) content-box bounding-box");163 negativeTest("-webkit-clip-path", "circle(50% at 50% 50%) content-box stroke"); 160 164 negativeTest("-webkit-clip-path", "content-box margin-box padding-box"); 161 165 negativeTest("-webkit-clip-path", "none content-box"); -
trunk/Source/WebCore/ChangeLog
r163763 r163764 1 2014-02-09 Dirk Schulze <dschulze@chromium.org> 2 3 -webkit-clip-path should support fill, stroke, view-box keywords 4 https://bugs.webkit.org/show_bug.cgi?id=128393 5 6 Reviewed by Dean Jackson. 7 8 CSS Masking uses the keywords fill, stroke and view-box for SVG shapes. 9 This patch updates the parser, style resolver and SVG implementation of 10 the prefixed clip-path property. 11 12 Remove the unexposed and obsolete keyword bounding-box. 13 14 Tests: svg/clip-path/clip-path-shape-fill-expected.svg 15 svg/clip-path/clip-path-shape-fill.svg 16 svg/clip-path/clip-path-shape-stroke-expected.svg 17 svg/clip-path/clip-path-shape-stroke.svg 18 svg/clip-path/clip-path-shape-view-box-expected.svg 19 svg/clip-path/clip-path-shape-view-box.svg 20 21 * css/CSSParser.cpp: Parse fill, stroke, view-box. Remove bounding-box. 22 (WebCore::isBoxValue): 23 * css/CSSPrimitiveValueMappings.h: 24 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 25 (WebCore::CSSPrimitiveValue::operator LayoutBox): 26 * css/CSSValueKeywords.in: 27 * css/DeprecatedStyleBuilder.cpp: 28 (WebCore::ApplyPropertyClipPath::applyValue): 29 * rendering/RenderLayer.cpp: 30 (WebCore::computeReferenceBox): 31 * rendering/shapes/ShapeInfo.h: 32 (WebCore::ShapeInfo::setShapeSize): 33 (WebCore::ShapeInfo::logicalTopOffset): 34 (WebCore::ShapeInfo::logicalLeftOffset): 35 * rendering/style/RenderStyleConstants.h: 36 * rendering/svg/SVGRenderingContext.cpp: Use different reference boxes per keyword. 37 (WebCore::SVGRenderingContext::prepareToRenderSVGContent): 38 1 39 2014-02-09 Dean Jackson <dino@apple.com> 2 40 -
trunk/Source/WebCore/css/CSSParser.cpp
r163747 r163764 5822 5822 case CSSValueMarginBox: 5823 5823 return true; 5824 case CSSValueBoundingBox: 5824 case CSSValueFill: 5825 case CSSValueStroke: 5826 case CSSValueViewBox: 5825 5827 return propId == CSSPropertyWebkitClipPath; 5826 5828 default: break; -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r163560 r163764 5127 5127 m_primitiveUnitType = CSS_VALUE_ID; 5128 5128 switch (layoutBox) { 5129 case BoundingBox:5130 m_value.valueID = CSSValueBoundingBox;5131 break;5132 5129 case MarginBox: 5133 5130 m_value.valueID = CSSValueMarginBox; … … 5141 5138 case ContentBox: 5142 5139 m_value.valueID = CSSValueContentBox; 5140 break; 5141 case Fill: 5142 m_value.valueID = CSSValueFill; 5143 break; 5144 case Stroke: 5145 m_value.valueID = CSSValueStroke; 5146 break; 5147 case ViewBox: 5148 m_value.valueID = CSSValueViewBox; 5143 5149 break; 5144 5150 case BoxMissing: … … 5152 5158 { 5153 5159 switch (getValueID()) { 5154 case CSSValueBoundingBox:5155 return BoundingBox;5156 5160 case CSSValueMarginBox: 5157 5161 return MarginBox; … … 5162 5166 case CSSValueContentBox: 5163 5167 return ContentBox; 5168 // The following are used in an SVG context. 5169 case CSSValueFill: 5170 return Fill; 5171 case CSSValueStroke: 5172 return Stroke; 5173 case CSSValueViewBox: 5174 return ViewBox; 5164 5175 default: 5165 5176 break; -
trunk/Source/WebCore/css/CSSValueKeywords.in
r163560 r163764 746 746 747 747 // clip-path 748 bounding-box748 view-box 749 749 750 750 // -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r163717 r163764 2140 2140 || primitiveValue.getValueID() == CSSValuePaddingBox 2141 2141 || primitiveValue.getValueID() == CSSValueMarginBox 2142 || primitiveValue.getValueID() == CSSValueBoundingBox) 2142 || primitiveValue.getValueID() == CSSValueFill 2143 || primitiveValue.getValueID() == CSSValueStroke 2144 || primitiveValue.getValueID() == CSSValueViewBox) 2143 2145 && referenceBox == BoxMissing) 2144 2146 referenceBox = LayoutBox(primitiveValue); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r163703 r163764 3791 3791 referenceBox.moveBy(rootRelativeBounds.location()); 3792 3792 break; 3793 // fill, stroke, view-box compute to border-box for HTML elements. 3794 case Fill: 3795 case Stroke: 3796 case ViewBox: 3793 3797 case BorderBox: 3794 3798 referenceBox = box.borderBoxRect(); … … 3798 3802 // FIXME: Support margin-box. Use bounding client rect for now. 3799 3803 // https://bugs.webkit.org/show_bug.cgi?id=127984 3800 case BoundingBox:3801 3804 case BoxMissing: 3802 3805 // FIXME: If no reference box was specified the spec demands to use -
trunk/Source/WebCore/rendering/shapes/ShapeInfo.h
r161569 r163764 90 90 logicalWidth -= m_renderer.borderAndPaddingLogicalWidth(); 91 91 break; 92 case BoundingBox: 92 case Fill: 93 case Stroke: 94 case ViewBox: 93 95 case BoxMissing: 94 96 ASSERT_NOT_REACHED(); … … 177 179 case PaddingBox: return m_renderer.borderBefore(); 178 180 case ContentBox: return m_renderer.borderAndPaddingBefore(); 179 case BoundingBox: break; 181 case Fill: break; 182 case Stroke: break; 183 case ViewBox: break; 180 184 case BoxMissing: break; 181 185 } … … 194 198 case PaddingBox: return m_renderer.borderStart(); 195 199 case ContentBox: return m_renderer.borderAndPaddingStart(); 196 case BoundingBox: break; 200 case Fill: break; 201 case Stroke: break; 202 case ViewBox: break; 197 203 case BoxMissing: break; 198 204 } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r163560 r163764 545 545 #endif 546 546 547 enum LayoutBox { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, BoundingBox }; 547 // Fill, Stroke, ViewBox are just used for SVG. 548 enum LayoutBox { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, Fill, Stroke, ViewBox }; 548 549 549 550 } // namespace WebCore -
trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
r163440 r163764 36 36 #include "RenderSVGResourceMasker.h" 37 37 #include "RenderView.h" 38 #include "SVGLengthContext.h" 38 39 #include "SVGResources.h" 39 40 #include "SVGResourcesCache.h" … … 122 123 ClipPathOperation* clipPathOperation = style.clipPath(); 123 124 if (clipPathOperation && clipPathOperation->type() == ClipPathOperation::Shape) { 124 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation); 125 m_paintInfo->context->clipPath(clipPath->pathForReferenceRect(renderer.objectBoundingBox()), clipPath->windRule()); 125 ShapeClipPathOperation& clipPath = toShapeClipPathOperation(*clipPathOperation); 126 FloatRect referenceBox; 127 if (clipPath.referenceBox() == Stroke) 128 // FIXME: strokeBoundingBox() takes dasharray into account but shouldn't. 129 referenceBox = renderer.strokeBoundingBox(); 130 else if (clipPath.referenceBox() == ViewBox && renderer.element()) { 131 FloatSize viewportSize; 132 SVGLengthContext(toSVGElement(renderer.element())).determineViewport(viewportSize); 133 referenceBox.setWidth(viewportSize.width()); 134 referenceBox.setHeight(viewportSize.height()); 135 } else 136 referenceBox = renderer.objectBoundingBox(); 137 m_paintInfo->context->clipPath(clipPath.pathForReferenceRect(referenceBox), clipPath.windRule()); 126 138 } 127 139
Note: See TracChangeset
for help on using the changeset viewer.