Changeset 161209 in webkit
- Timestamp:
- Jan 2, 2014 10:11:51 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r161195 r161209 1 2014-01-02 Dirk Schulze <krit@webkit.org> 2 3 Support <box> values computed style for 'clip-path' property 4 https://bugs.webkit.org/show_bug.cgi?id=126148 5 6 Reviewed by Simon Fraser. 7 8 Test computed style of 'clip-path' property. 9 10 * fast/masking/parsing-clip-path-shape.html: 11 1 12 2014-01-01 Antti Koivisto <antti@apple.com> 2 13 -
trunk/LayoutTests/fast/masking/parsing-clip-path-shape-expected.txt
r161067 r161209 59 59 PASS innerStyle("-webkit-clip-path", "border-box circle(50% at 50% 50%)") is "border-box circle(50% at 50% 50%)" 60 60 PASS innerStyle("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box") is "circle(50% at 50% 50%) bounding-box" 61 PASS computedStyle("-webkit-clip-path", "content-box") is "content-box" 62 PASS computedStyle("-webkit-clip-path", "padding-box") is "padding-box" 63 PASS computedStyle("-webkit-clip-path", "border-box") is "border-box" 64 PASS computedStyle("-webkit-clip-path", "margin-box") is "margin-box" 65 PASS computedStyle("-webkit-clip-path", "bounding-box") is "bounding-box" 66 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) content-box") is "circle(50% at 50% 50%) content-box" 67 PASS computedStyle("-webkit-clip-path", "circle(50% at 50% 50%) padding-box") is "circle(50% at 50% 50%) padding-box" 68 PASS computedStyle("-webkit-clip-path", "margin-box circle(50% at 50% 50%)") is "circle(50% at 50% 50%) margin-box" 69 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" 61 71 PASS innerStyle("-webkit-clip-path", "circle(1px, 1px, 1)") is null 62 72 PASS computedStyle("-webkit-clip-path", "circle(1px, 1px, 1)") is "none" -
trunk/LayoutTests/fast/masking/parsing-clip-path-shape.html
r161067 r161209 119 119 testInner("-webkit-clip-path", "circle(50% at 50% 50%) bounding-box", "circle(50% at 50% 50%) bounding-box"); 120 120 121 testComputed("-webkit-clip-path", "content-box", "content-box"); 122 testComputed("-webkit-clip-path", "padding-box", "padding-box"); 123 testComputed("-webkit-clip-path", "border-box", "border-box"); 124 testComputed("-webkit-clip-path", "margin-box", "margin-box"); 125 testComputed("-webkit-clip-path", "bounding-box", "bounding-box"); 126 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) content-box", "circle(50% at 50% 50%) content-box"); 127 testComputed("-webkit-clip-path", "circle(50% at 50% 50%) padding-box", "circle(50% at 50% 50%) padding-box"); 128 testComputed("-webkit-clip-path", "margin-box circle(50% at 50% 50%)", "circle(50% at 50% 50%) margin-box"); 129 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"); 131 121 132 // reject non-lengths 122 133 negativeTest("-webkit-clip-path", "circle(1px, 1px, 1)"); -
trunk/Source/WebCore/ChangeLog
r161208 r161209 1 2014-01-02 Dirk Schulze <krit@webkit.org> 2 3 Support <box> values computed style for 'clip-path' property 4 https://bugs.webkit.org/show_bug.cgi?id=126148 5 6 Reviewed by Simon Fraser. 7 8 Calculate computed style for 'clip-path' property. 9 10 Updated tests to check for computed style. 11 12 * css/BasicShapeFunctions.cpp: Add box value bounding-box. 13 (WebCore::valueForBox): 14 (WebCore::boxForValue): 15 * css/CSSComputedStyleDeclaration.cpp: Return the computed style 16 for 'clip-path'. 17 (WebCore::ComputedStyleExtractor::propertyValue): 18 * css/DeprecatedStyleBuilder.cpp: Create CSSValueLists for 'clip-th'. 19 (WebCore::ApplyPropertyClipPath::applyValue): 20 * rendering/ClipPathOperation.h: Add bounding-box value. 21 (WebCore::ShapeClipPathOperation::pathForReferenceRect): 22 (WebCore::ShapeClipPathOperation::setReferenceBox): 23 (WebCore::ShapeClipPathOperation::referenceBox): 24 (WebCore::BoxClipPathOperation::create): 25 (WebCore::BoxClipPathOperation::pathForReferenceRect): 26 (WebCore::BoxClipPathOperation::referenceBox): 27 (WebCore::BoxClipPathOperation::BoxClipPathOperation): 28 * rendering/shapes/ShapeInfo.h: Add bounding-box value. 29 (WebCore::ShapeInfo::setShapeSize): 30 (WebCore::ShapeInfo::logicalTopOffset): 31 (WebCore::ShapeInfo::logicalLeftOffset): 32 * rendering/style/BasicShapes.cpp: Add bounding-box value. 33 (WebCore::BasicShape::referenceBoxSize): 34 * rendering/style/BasicShapes.h: 35 1 36 2014-01-02 Antti Koivisto <antti@apple.com> 2 37 -
trunk/Source/WebCore/css/BasicShapeFunctions.cpp
r160176 r161209 51 51 case BasicShape::MarginBox: 52 52 return cssValuePool().createIdentifierValue(CSSValueMarginBox); 53 case BasicShape::BoundingBox: 54 return cssValuePool().createIdentifierValue(CSSValueBoundingBox); 53 55 case BasicShape::None: 54 56 return nullptr; … … 72 74 case CSSValueMarginBox: 73 75 return BasicShape::MarginBox; 76 case CSSValueBoundingBox: 77 return BasicShape::BoundingBox; 74 78 default: 75 79 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r160908 r161209 5 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 2860 2861 case CSSPropertyCounterReset: 2861 2862 return counterToCSSValue(style.get(), propertyID); 2862 case CSSPropertyWebkitClipPath: 2863 if (ClipPathOperation* operation = style->clipPath()) {2864 if (operation->type() == ClipPathOperation::SHAPE)2865 return valueForBasicShape(style.get(), static_cast<ShapeClipPathOperation*>(operation)->basicShape());2863 case CSSPropertyWebkitClipPath: { 2864 ClipPathOperation* operation = style->clipPath(); 2865 if (!operation) 2866 return cssValuePool().createIdentifierValue(CSSValueNone); 2866 2867 #if ENABLE(SVG) 2867 if (operation->type() == ClipPathOperation::REFERENCE) { 2868 ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation); 2869 return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI); 2870 } 2871 #endif 2868 if (operation->type() == ClipPathOperation::Reference) { 2869 ReferenceClipPathOperation& referenceOperation = toReferenceClipPathOperation(*operation); 2870 return CSSPrimitiveValue::create(referenceOperation.url(), CSSPrimitiveValue::CSS_URI); 2872 2871 } 2873 return cssValuePool().createIdentifierValue(CSSValueNone); 2872 #endif 2873 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 2874 if (operation->type() == ClipPathOperation::Shape) { 2875 ShapeClipPathOperation& shapeOperation = toShapeClipPathOperation(*operation); 2876 list->append(valueForBasicShape(style.get(), shapeOperation.basicShape())); 2877 if (shapeOperation.referenceBox() != BasicShape::ReferenceBox::None) 2878 list->append(valueForBox(shapeOperation.referenceBox())); 2879 } 2880 if (operation->type() == ClipPathOperation::Box) { 2881 BoxClipPathOperation& boxOperation = toBoxClipPathOperation(*operation); 2882 list->append(valueForBox(boxOperation.referenceBox())); 2883 } 2884 return list.release(); 2885 } 2874 2886 #if ENABLE(CSS_REGIONS) 2875 2887 case CSSPropertyWebkitFlowInto: -
trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp
r161067 r161209 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 4 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 2063 2064 if (!value->isValueList()) 2064 2065 return; 2066 BasicShape::ReferenceBox referenceBox = BasicShape::ReferenceBox::None; 2067 RefPtr<ClipPathOperation> operation; 2065 2068 auto& valueList = toCSSValueList(*value); 2066 2069 for (unsigned i = 0; i < valueList.length(); ++i) { 2067 // FIXME: <box> values are not supported yet.2068 // https://bugs.webkit.org/show_bug.cgi?id=1261482069 2070 auto& primitiveValue = toCSSPrimitiveValue(*valueList.itemWithoutBoundsCheck(i)); 2070 if (!primitiveValue.isShape()) 2071 continue; 2072 setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue.getShapeValue()))); 2073 break; 2074 } 2071 if (primitiveValue.isShape() && !operation) 2072 operation = ShapeClipPathOperation::create(basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue.getShapeValue())); 2073 else if ((primitiveValue.getValueID() == CSSValueContentBox 2074 || primitiveValue.getValueID() == CSSValueBorderBox 2075 || primitiveValue.getValueID() == CSSValuePaddingBox 2076 || primitiveValue.getValueID() == CSSValueMarginBox 2077 || primitiveValue.getValueID() == CSSValueBoundingBox) 2078 && referenceBox == BasicShape::ReferenceBox::None) 2079 referenceBox = boxForValue(&primitiveValue); 2080 else 2081 return; 2082 } 2083 if (!operation) { 2084 if (referenceBox == BasicShape::ReferenceBox::None) 2085 return; 2086 operation = BoxClipPathOperation::create(referenceBox); 2087 } else 2088 toShapeClipPathOperation(operation.get())->setReferenceBox(referenceBox); 2089 setValue(styleResolver->style(), operation.release()); 2075 2090 } 2076 2091 static PropertyHandler createHandler() -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r161106 r161209 132 132 133 133 // Other clip-path operations than BasicShapes can not be animated. 134 if (from->type() != ClipPathOperation::S HAPE || to->type() != ClipPathOperation::SHAPE)134 if (from->type() != ClipPathOperation::Shape || to->type() != ClipPathOperation::Shape) 135 135 return to; 136 136 -
trunk/Source/WebCore/rendering/ClipPathOperation.h
r157823 r161209 1 1 /* 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 public: 44 44 enum OperationType { 45 REFERENCE, 46 SHAPE 45 Reference, 46 Shape, 47 Box 47 48 }; 48 49 … … 84 85 85 86 ReferenceClipPathOperation(const String& url, const String& fragment) 86 : ClipPathOperation(R EFERENCE)87 : ClipPathOperation(Reference) 87 88 , m_url(url) 88 89 , m_fragment(fragment) … … 103 104 const BasicShape* basicShape() const { return m_shape.get(); } 104 105 WindRule windRule() const { return m_shape->windRule(); } 105 const Path & path(const FloatRect& boundingRect)106 const Path pathForReferenceRect(const FloatRect& boundingRect) const 106 107 { 107 108 ASSERT(m_shape); 108 m_path.clear(); 109 m_path = adoptPtr(new Path); 110 m_shape->path(*m_path, boundingRect); 111 return *m_path; 109 // FIXME: Make clipping path from basic-shapes relative to <box> value. 110 // https://bugs.webkit.org/show_bug.cgi?id=126206 111 Path path; 112 m_shape->path(path, boundingRect); 113 return path; 112 114 } 115 116 void setReferenceBox(BasicShape::ReferenceBox referenceBox) { m_referenceBox = referenceBox; } 117 BasicShape::ReferenceBox referenceBox() const { return m_referenceBox; } 113 118 114 119 private: … … 122 127 123 128 explicit ShapeClipPathOperation(PassRefPtr<BasicShape> shape) 124 : ClipPathOperation(S HAPE)129 : ClipPathOperation(Shape) 125 130 , m_shape(shape) 131 , m_referenceBox(BasicShape::ReferenceBox::None) 126 132 { 127 133 } 128 134 129 135 RefPtr<BasicShape> m_shape; 130 OwnPtr<Path> m_path;136 BasicShape::ReferenceBox m_referenceBox; 131 137 }; 132 } 138 139 class BoxClipPathOperation : public ClipPathOperation { 140 public: 141 static PassRefPtr<BoxClipPathOperation> create(BasicShape::ReferenceBox referenceBox) 142 { 143 return adoptRef(new BoxClipPathOperation(referenceBox)); 144 } 145 146 const Path pathForReferenceRect(const FloatRect&) const 147 { 148 Path path; 149 // FIXME: Create clipping path from <box>. 150 // https://bugs.webkit.org/show_bug.cgi?id=126205 151 return path; 152 } 153 BasicShape::ReferenceBox referenceBox() const { return m_referenceBox; } 154 155 private: 156 virtual bool operator==(const ClipPathOperation& o) const OVERRIDE 157 { 158 if (!isSameType(o)) 159 return false; 160 const BoxClipPathOperation* other = static_cast<const BoxClipPathOperation*>(&o); 161 return m_referenceBox == other->m_referenceBox; 162 } 163 164 explicit BoxClipPathOperation(BasicShape::ReferenceBox referenceBox) 165 : ClipPathOperation(Box) 166 , m_referenceBox(referenceBox) 167 { 168 } 169 170 BasicShape::ReferenceBox m_referenceBox; 171 }; 172 173 #define CLIP_PATH_OPERATION_CASTS(ToValueTypeName, predicate) \ 174 TYPE_CASTS_BASE(ToValueTypeName, ClipPathOperation, operation, operation->type() == ClipPathOperation::predicate, operation.type() == ClipPathOperation::predicate) 175 176 CLIP_PATH_OPERATION_CASTS(ReferenceClipPathOperation, Reference) 177 CLIP_PATH_OPERATION_CASTS(ShapeClipPathOperation, Shape) 178 CLIP_PATH_OPERATION_CASTS(BoxClipPathOperation, Box) 179 180 } // namespace WebCore 133 181 134 182 #endif // ClipPathOperation_h -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r161153 r161209 3917 3917 3918 3918 ASSERT(style.clipPath()); 3919 if (style.clipPath()->type() == ClipPathOperation::S HAPE) {3919 if (style.clipPath()->type() == ClipPathOperation::Shape) { 3920 3920 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(style.clipPath()); 3921 3921 … … 3926 3926 3927 3927 context->save(); 3928 context->clipPath(clipPath->path (rootRelativeBounds), clipPath->windRule());3928 context->clipPath(clipPath->pathForReferenceRect(rootRelativeBounds), clipPath->windRule()); 3929 3929 return true; 3930 3930 } 3931 3931 3932 3932 #if ENABLE(SVG) 3933 if (style.clipPath()->type() == ClipPathOperation::R EFERENCE) {3933 if (style.clipPath()->type() == ClipPathOperation::Reference) { 3934 3934 ReferenceClipPathOperation* referenceClipPathOperation = static_cast<ReferenceClipPathOperation*>(style.clipPath()); 3935 3935 Element* element = renderer().document().getElementById(referenceClipPathOperation->fragment()); -
trunk/Source/WebCore/rendering/shapes/ShapeInfo.h
r160243 r161209 90 90 logicalWidth -= m_renderer.borderAndPaddingLogicalWidth(); 91 91 break; 92 case BasicShape::BoundingBox: 92 93 case BasicShape::None: 93 94 ASSERT_NOT_REACHED(); … … 176 177 case BasicShape::PaddingBox: return m_renderer.borderBefore(); 177 178 case BasicShape::ContentBox: return m_renderer.borderAndPaddingBefore(); 179 case BasicShape::BoundingBox: break; 178 180 case BasicShape::None: break; 179 181 } … … 192 194 case BasicShape::PaddingBox: return m_renderer.borderStart(); 193 195 case BasicShape::ContentBox: return m_renderer.borderAndPaddingStart(); 196 case BasicShape::BoundingBox: break; 194 197 case BasicShape::None: break; 195 198 } -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r160770 r161209 87 87 return FloatSize(renderer.marginLeft() + renderer.width() + renderer.marginRight(), 88 88 renderer.marginTop() + renderer.height() + renderer.marginBottom()); 89 case BoundingBox: 90 break; 89 91 } 90 92 -
trunk/Source/WebCore/rendering/style/BasicShapes.h
r160770 r161209 64 64 PaddingBox, 65 65 BorderBox, 66 MarginBox 66 MarginBox, 67 BoundingBox 67 68 }; 68 69 -
trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
r160615 r161209 124 124 125 125 ClipPathOperation* clipPathOperation = style.clipPath(); 126 if (clipPathOperation && clipPathOperation->type() == ClipPathOperation::S HAPE) {126 if (clipPathOperation && clipPathOperation->type() == ClipPathOperation::Shape) { 127 127 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation); 128 m_paintInfo->context->clipPath(clipPath->path (renderer.objectBoundingBox()), clipPath->windRule());128 m_paintInfo->context->clipPath(clipPath->pathForReferenceRect(renderer.objectBoundingBox()), clipPath->windRule()); 129 129 } 130 130
Note: See TracChangeset
for help on using the changeset viewer.