Changeset 177289 in webkit
- Timestamp:
- Dec 15, 2014 10:57:58 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r177284 r177289 1 2014-12-15 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Shapes] Fix StyleBuilder code to use CSSValueNone to match spec and other code 4 https://bugs.webkit.org/show_bug.cgi?id=139601 5 6 Reviewed by Chris Dumez. 7 8 Change the code to properly use CSSValueNone instead of CSSValueAuto. 9 Asserts have been added to catch similar errors in the future. 10 In doing this change, it became apparent that there is nothing 11 special about the shape-outside property that requires custom code, so 12 it was changed to use a standard converter function. 13 14 No change observable via LayoutTests. 15 16 * css/CSSPropertyNames.in: Use a converter instead of custom code. 17 * css/StyleBuilderConverter.h: 18 (WebCore::isImageShape): Helper function so that isImageSetValue can 19 be properly guarded. 20 (WebCore::StyleBuilderConverter::convertShapeValue): Format as a 21 converter instead of custom code. 22 * css/StyleBuilderCustom.h: 23 (WebCore::StyleBuilderCustom::applyValueWebkitShapeOutside): Deleted. 24 1 25 2014-12-15 Oliver Hunt <oliver@apple.com> 2 26 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r177282 r177289 537 537 #endif 538 538 #if defined(ENABLE_CSS_SHAPES) && ENABLE_CSS_SHAPES 539 -webkit-shape-outside [C ustom=Value]539 -webkit-shape-outside [Converter=ShapeValue] 540 540 -webkit-shape-margin [Converter=Length] 541 541 -webkit-shape-image-threshold [Converter=Number<float>] -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r177282 r177289 30 30 #include "BasicShapeFunctions.h" 31 31 #include "CSSCalculationValue.h" 32 #include "CSSImageGeneratorValue.h" 33 #include "CSSImageSetValue.h" 34 #include "CSSImageValue.h" 32 35 #include "CSSPrimitiveValue.h" 33 36 #include "CSSReflectValue.h" … … 75 78 static LineBoxContain convertLineBoxContain(StyleResolver&, CSSValue&); 76 79 static TextDecorationSkip convertTextDecorationSkip(StyleResolver&, CSSValue&); 80 static PassRefPtr<ShapeValue> convertShapeValue(StyleResolver&, CSSValue&); 77 81 78 82 private: … … 587 591 } 588 592 593 #if ENABLE(CSS_SHAPES) 594 static inline bool isImageShape(const CSSValue& value) 595 { 596 return is<CSSImageValue>(value) 597 #if ENABLE(CSS_IMAGE_SET) 598 || is<CSSImageSetValue>(value) 599 #endif 600 || is<CSSImageGeneratorValue>(value); 601 } 602 603 inline PassRefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleResolver& styleResolver, CSSValue& value) 604 { 605 if (is<CSSPrimitiveValue>(value)) { 606 ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone); 607 return nullptr; 608 } 609 610 if (isImageShape(value)) 611 return ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value)); 612 613 RefPtr<BasicShape> shape; 614 CSSBoxType referenceBox = BoxMissing; 615 for (auto& currentValue : downcast<CSSValueList>(value)) { 616 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(currentValue.get()); 617 if (primitiveValue.isShape()) 618 shape = basicShapeForValue(styleResolver.state().cssToLengthConversionData(), primitiveValue.getShapeValue()); 619 else if (primitiveValue.getValueID() == CSSValueContentBox 620 || primitiveValue.getValueID() == CSSValueBorderBox 621 || primitiveValue.getValueID() == CSSValuePaddingBox 622 || primitiveValue.getValueID() == CSSValueMarginBox) 623 referenceBox = primitiveValue; 624 else { 625 ASSERT_NOT_REACHED(); 626 return nullptr; 627 } 628 } 629 630 if (shape) 631 return ShapeValue::createShapeValue(shape.release(), referenceBox); 632 633 if (referenceBox != BoxMissing) 634 return ShapeValue::createBoxShapeValue(referenceBox); 635 636 ASSERT_NOT_REACHED(); 637 return nullptr; 638 } 639 #endif // ENABLE(CSS_SHAPES) 589 640 590 641 } // namespace WebCore -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r177274 r177289 28 28 #define StyleBuilderCustom_h 29 29 30 #include "BasicShapeFunctions.h"31 30 #include "CSSAspectRatioValue.h" 32 #include "CSSImageGeneratorValue.h"33 #include "CSSImageSetValue.h"34 #include "CSSImageValue.h"35 31 #include "CSSShadowValue.h" 36 32 #include "Frame.h" … … 53 49 static void applyInheritZoom(StyleResolver&); 54 50 static void applyValueZoom(StyleResolver&, CSSValue&); 55 56 #if ENABLE(CSS_SHAPES)57 static void applyValueWebkitShapeOutside(StyleResolver&, CSSValue&);58 #endif // ENABLE(CSS_SHAPES)59 51 60 52 static void applyValueVerticalAlign(StyleResolver&, CSSValue&); … … 237 229 } 238 230 } 239 240 #if ENABLE(CSS_SHAPES)241 inline void StyleBuilderCustom::applyValueWebkitShapeOutside(StyleResolver& styleResolver, CSSValue& value)242 {243 if (is<CSSPrimitiveValue>(value)) {244 // FIXME: Shouldn't this be CSSValueNone?245 // http://www.w3.org/TR/css-shapes/#shape-outside-property246 if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)247 styleResolver.style()->setShapeOutside(nullptr);248 } if (is<CSSImageValue>(value) || is<CSSImageGeneratorValue>(value) || is<CSSImageSetValue>(value)) {249 RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value));250 styleResolver.style()->setShapeOutside(shape.release());251 } else if (is<CSSValueList>(value)) {252 RefPtr<BasicShape> shape;253 CSSBoxType referenceBox = BoxMissing;254 for (auto& currentValue : downcast<CSSValueList>(value)) {255 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(currentValue.get());256 if (primitiveValue.isShape())257 shape = basicShapeForValue(styleResolver.state().cssToLengthConversionData(), primitiveValue.getShapeValue());258 else if (primitiveValue.getValueID() == CSSValueContentBox259 || primitiveValue.getValueID() == CSSValueBorderBox260 || primitiveValue.getValueID() == CSSValuePaddingBox261 || primitiveValue.getValueID() == CSSValueMarginBox)262 referenceBox = CSSBoxType(primitiveValue);263 else264 return;265 }266 267 if (shape)268 styleResolver.style()->setShapeOutside(ShapeValue::createShapeValue(shape.release(), referenceBox));269 else if (referenceBox != BoxMissing)270 styleResolver.style()->setShapeOutside(ShapeValue::createBoxShapeValue(referenceBox));271 }272 }273 #endif // ENABLE(CSS_SHAPES)274 275 231 inline Length StyleBuilderCustom::mmLength(double mm) 276 232 {
Note: See TracChangeset
for help on using the changeset viewer.