Changeset 150904 in webkit
- Timestamp:
- May 29, 2013 9:54:39 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r150892 r150904 1 2013-05-29 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Shapes] Support parsing inset-rectangle shapes 4 https://bugs.webkit.org/show_bug.cgi?id=116638 5 6 Reviewed by Dean Jackson. 7 8 Updated to test for inset-rectangle cases. 9 10 * fast/exclusions/parsing/parsing-shape-inside-expected.txt: 11 * fast/exclusions/parsing/parsing-shape-lengths-expected.txt: 12 * fast/exclusions/parsing/script-tests/parsing-shape-lengths.js: 13 * fast/exclusions/parsing/script-tests/parsing-test-utils.js: 14 1 15 2013-05-29 Gabor Abraham <abrhm@inf.u-szeged.hu> 2 16 -
trunk/LayoutTests/fast/exclusions/parsing/parsing-shape-inside-expected.txt
r150542 r150904 12 12 PASS getCSSText("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 13 13 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 14 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)" 15 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)" 16 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)" 17 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)" 18 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 19 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 14 20 PASS getCSSText("-webkit-shape-inside", "circle(10px, 20px, 30px)") is "circle(10px, 20px, 30px)" 15 21 PASS getComputedStyleValue("-webkit-shape-inside", "circle(10px, 20px, 30px)") is "circle(10px, 20px, 30px)" … … 42 48 PASS getCSSText("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "" 43 49 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "outside-shape" 50 PASS getCSSText("-webkit-shape-inside", "inset-rectangle()") is "" 51 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle()") is "outside-shape" 52 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px)") is "" 53 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px)") is "outside-shape" 54 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 10px)") is "" 55 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 10px)") is "outside-shape" 56 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px)") is "" 57 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px)") is "outside-shape" 58 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px 20px 30px 40px)") is "" 59 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px 20px 30px 40px)") is "outside-shape" 60 PASS getCSSText("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "" 61 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "outside-shape" 44 62 PASS getCSSText("-webkit-shape-inside", "circle()") is "" 45 63 PASS getComputedStyleValue("-webkit-shape-inside", "circle()") is "outside-shape" -
trunk/LayoutTests/fast/exclusions/parsing/parsing-shape-lengths-expected.txt
r150542 r150904 9 9 PASS getStyleValue("-webkit-shape-inside", "circle(-.5px, +.5px, .5px)") is "circle(-0.5px, 0.5px, 0.5px)" 10 10 PASS getStyleValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)") is "rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)" 11 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)") is "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)" 11 12 PASS getStyleValue("-webkit-shape-inside", "circle(-1em, +1em, 1em)") is "circle(-1em, 1em, 1em)" 12 13 PASS getStyleValue("-webkit-shape-inside", "circle(-1.5em, +1.5em, 1.5em)") is "circle(-1.5em, 1.5em, 1.5em)" … … 24 25 PASS getStyleValue("-webkit-shape-inside", "circle(100%, 100%, 100%)") is "circle(100%, 100%, 100%)" 25 26 PASS getStyleValue("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "rectangle(45%, 45%, 90%, 60%, 25%, 10%)" 27 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)" 26 28 PASS getStyleValue("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)") is "ellipse(100%, 100%, 100%, 100%)" 27 29 PASS getStyleValue("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)") is "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)" 28 30 PASS getComputedStyleValue("-webkit-shape-inside", "circle(50%, 100%, 150%)") is "circle(50%, 100%, 150%)" 29 31 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "rectangle(45%, 45%, 90%, 60%, 25%, 10%)" 32 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)") is "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)" 30 33 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(100%, 100%, 100%, 100%)") is "ellipse(100%, 100%, 100%, 100%)" 31 34 PASS getComputedStyleValue("-webkit-shape-inside", "polygon(10% 20%, 30% 40%, 40% 50%)") is "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)" … … 44 47 PASS getStyleValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is null 45 48 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is "outside-shape" 49 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)") is null 50 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)") is "outside-shape" 51 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is null 52 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)") is "outside-shape" 46 53 PASS getStyleValue("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)") is null 47 54 PASS getComputedStyleValue("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)") is "outside-shape" … … 52 59 PASS getStyleValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is null 53 60 PASS getComputedStyleValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is "outside-shape" 61 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(-1cm, 1mm, 1in, 1px, 1pt, 1pc)") is null 62 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(-1cm, 1mm, 1in, 1px, 1pt, 1pc)") is "outside-shape" 63 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, -1mm, 1in, 1px, 1pt, 1pc)") is null 64 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, -1mm, 1in, 1px, 1pt, 1pc)") is "outside-shape" 65 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)") is null 66 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)") is "outside-shape" 67 PASS getStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is null 68 PASS getComputedStyleValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)") is "outside-shape" 54 69 PASS successfullyParsed is true 55 70 -
trunk/LayoutTests/fast/exclusions/parsing/parsing-shape-outside-expected.txt
r150542 r150904 12 12 PASS getCSSText("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 13 13 PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 14 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)" 15 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px)") is "inset-rectangle(10px, 20px, 30px, 40px)" 16 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)" 17 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px)" 18 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 19 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)") is "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)" 14 20 PASS getCSSText("-webkit-shape-outside", "circle(10px, 20px, 30px)") is "circle(10px, 20px, 30px)" 15 21 PASS getComputedStyleValue("-webkit-shape-outside", "circle(10px, 20px, 30px)") is "circle(10px, 20px, 30px)" … … 40 46 PASS getCSSText("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "" 41 47 PASS getComputedStyleValue("-webkit-shape-outside", "rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "auto" 48 PASS getCSSText("-webkit-shape-outside", "inset-rectangle()") is "" 49 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle()") is "auto" 50 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px)") is "" 51 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px)") is "auto" 52 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 10px)") is "" 53 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 10px)") is "auto" 54 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px)") is "" 55 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px)") is "auto" 56 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px 20px 30px 40px)") is "" 57 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px 20px 30px 40px)") is "auto" 58 PASS getCSSText("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "" 59 PASS getComputedStyleValue("-webkit-shape-outside", "inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)") is "auto" 42 60 PASS getCSSText("-webkit-shape-outside", "circle()") is "" 43 61 PASS getComputedStyleValue("-webkit-shape-outside", "circle()") is "auto" -
trunk/LayoutTests/fast/exclusions/parsing/script-tests/parsing-shape-lengths.js
r150542 r150904 34 34 35 35 testStyleValue("rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)", "rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)"); 36 testStyleValue("inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)", "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)"); 36 37 37 38 // font-relative lengths - number serialization, units, resolution … … 59 60 testStyleValue("circle(100%, 100%, 100%)", "circle(100%, 100%, 100%)"); 60 61 testStyleValue("rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)"); 62 testStyleValue("inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)"); 61 63 testStyleValue("ellipse(100%, 100%, 100%, 100%)", "ellipse(100%, 100%, 100%, 100%)"); 62 64 testStyleValue("polygon(10% 20%, 30% 40%, 40% 50%)", "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)"); … … 64 66 testComputedStyleValue("circle(50%, 100%, 150%)", "circle(50%, 100%, 150%)"); 65 67 testComputedStyleValue("rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)"); 68 testComputedStyleValue("inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "inset-rectangle(45%, 45%, 90%, 60%, 25%, 10%)"); 66 69 testComputedStyleValue("ellipse(100%, 100%, 100%, 100%)", "ellipse(100%, 100%, 100%, 100%)"); 67 70 testComputedStyleValue("polygon(10% 20%, 30% 40%, 40% 50%)", "polygon(nonzero, 10% 20%, 30% 40%, 40% 50%)"); … … 77 80 testInvalidValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)"); 78 81 testInvalidValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)"); 82 testInvalidValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)"); 83 testInvalidValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)"); 79 84 testInvalidValue("-webkit-shape-inside", "ellipse(1em, 1em, -1em, 1em)"); 80 85 testInvalidValue("-webkit-shape-inside", "ellipse(1em, 1em, 1em, -1em)"); … … 83 88 testInvalidValue("-webkit-shape-inside", "rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)"); 84 89 testInvalidValue("-webkit-shape-inside", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)"); 90 91 // reject negative top, right, bottom, and left 92 testInvalidValue("-webkit-shape-inside", "inset-rectangle(-1cm, 1mm, 1in, 1px, 1pt, 1pc)"); 93 testInvalidValue("-webkit-shape-inside", "inset-rectangle(1cm, -1mm, 1in, 1px, 1pt, 1pc)"); 94 testInvalidValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)"); 95 testInvalidValue("-webkit-shape-inside", "inset-rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)"); -
trunk/LayoutTests/fast/exclusions/parsing/script-tests/parsing-test-utils.js
r150542 r150904 6 6 "rectangle(10px, 20px, 30px, 40px, 5px)", 7 7 "rectangle(10px, 20px, 30px, 40px, 5px, 10px)", 8 9 "inset-rectangle(10px, 20px, 30px, 40px)", 10 "inset-rectangle(10px, 20px, 30px, 40px, 5px)", 11 "inset-rectangle(10px, 20px, 30px, 40px, 5px, 10px)", 8 12 9 13 "circle(10px, 20px, 30px)", … … 28 32 "rectangle(10px 20px 30px 40px)", 29 33 "rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)", 34 35 "inset-rectangle()", 36 "inset-rectangle(10px)", 37 "inset-rectangle(10px, 10px)", 38 "inset-rectangle(10px, 20px, 30px)", 39 "inset-rectangle(10px 20px 30px 40px)", 40 "inset-rectangle(10px, 20px, 30px, 40px, 50px, 60px, 70px)", 30 41 31 42 "circle()", -
trunk/Source/WebCore/ChangeLog
r150901 r150904 1 2013-05-29 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Shapes] Support parsing inset-rectangle shapes 4 https://bugs.webkit.org/show_bug.cgi?id=116638 5 6 Reviewed by Dean Jackson. 7 8 Add parsing for inset-rectangle. It's very similar to parsing for 9 rectangle. 10 11 No new tests, updated existing tests to cover this. 12 13 * css/BasicShapeFunctions.cpp: 14 (WebCore::valueForBasicShape): Add support for inset rectangles. 15 (WebCore::basicShapeForValue): Add support for inset rectangles. 16 * css/CSSBasicShapes.cpp: 17 (WebCore::buildInsetRectangleString): Create an inset-rectangle css 18 string. 19 (WebCore::CSSBasicShapeInsetRectangle::cssText): Convert inset 20 rectangle shape to a CSS string. 21 (WebCore::CSSBasicShapeInsetRectangle::equals): Compare two inset 22 rectangles. 23 (WebCore::CSSBasicShapeInsetRectangle::serializeResolvingVariables): 24 Create an inset rectangle string, with CSS variables resolved. 25 (WebCore::CSSBasicShapeInsetRectangle::hasVariableReference): 26 Determine if this inset rectangle has any CSS Variable references. 27 * css/CSSBasicShapes.h: 28 (CSSBasicShapeInsetRectangle): Add inset rectangle class. This is a 29 direct representation of the CSS property. All the methods below 30 are just simple getters and setters, along with a construtor and a 31 factory method. 32 (WebCore::CSSBasicShapeInsetRectangle::create): 33 (WebCore::CSSBasicShapeInsetRectangle::top): 34 (WebCore::CSSBasicShapeInsetRectangle::right): 35 (WebCore::CSSBasicShapeInsetRectangle::bottom): 36 (WebCore::CSSBasicShapeInsetRectangle::left): 37 (WebCore::CSSBasicShapeInsetRectangle::radiusX): 38 (WebCore::CSSBasicShapeInsetRectangle::radiusY): 39 (WebCore::CSSBasicShapeInsetRectangle::setTop): 40 (WebCore::CSSBasicShapeInsetRectangle::setRight): 41 (WebCore::CSSBasicShapeInsetRectangle::setBottom): 42 (WebCore::CSSBasicShapeInsetRectangle::setLeft): 43 (WebCore::CSSBasicShapeInsetRectangle::setRadiusX): 44 (WebCore::CSSBasicShapeInsetRectangle::setRadiusY): 45 (WebCore::CSSBasicShapeInsetRectangle::type): 46 (WebCore::CSSBasicShapeInsetRectangle::CSSBasicShapeInsetRectangle): 47 (WebCore): 48 * css/CSSParser.cpp: 49 (WebCore::CSSParser::parseBasicShapeInsetRectangle): Parse the 50 inset-rectangle CSS property and create a 51 CSSBasicShapeInsetRectangle. 52 (WebCore::CSSParser::parseBasicShape): Add a call to parse 53 inset-rectangle. 54 * rendering/ExclusionShapeInsideInfo.cpp: 55 (WebCore::ExclusionShapeInsideInfo::isEnabledFor): Disable 56 inset-rectangles, since only the parsing has been implemented so 57 far. 58 * rendering/ExclusionShapeOutsideInfo.cpp: 59 (WebCore::ExclusionShapeOutsideInfo::isEnabledFor): Disable 60 inset-rectangles, since only the parsing has been implemented so 61 far. 62 * rendering/style/BasicShapes.cpp: 63 (WebCore::BasicShapeInsetRectangle::path): Calculate the Path for an 64 inset-rectangle. 65 (WebCore::BasicShapeInsetRectangle::blend): Blend two inset rectangles 66 together at a point depending on the "progress" and return the 67 blended rectangle. 68 * rendering/style/BasicShapes.h: 69 (BasicShapeInsetRectangle): Add higher level inset rectangle class. 70 This is used outside of the CSS representation. The methods below 71 are just simple getters and setters, along with a constructor and 72 a factory method. 73 (WebCore::BasicShapeInsetRectangle::create): 74 (WebCore::BasicShapeInsetRectangle::top): 75 (WebCore::BasicShapeInsetRectangle::right): 76 (WebCore::BasicShapeInsetRectangle::bottom): 77 (WebCore::BasicShapeInsetRectangle::left): 78 (WebCore::BasicShapeInsetRectangle::cornerRadiusX): 79 (WebCore::BasicShapeInsetRectangle::cornerRadiusY): 80 (WebCore::BasicShapeInsetRectangle::setTop): 81 (WebCore::BasicShapeInsetRectangle::setRight): 82 (WebCore::BasicShapeInsetRectangle::setBottom): 83 (WebCore::BasicShapeInsetRectangle::setLeft): 84 (WebCore::BasicShapeInsetRectangle::setCornerRadiusX): 85 (WebCore::BasicShapeInsetRectangle::setCornerRadiusY): 86 (WebCore::BasicShapeInsetRectangle::type): 87 (WebCore::BasicShapeInsetRectangle::BasicShapeInsetRectangle): 88 1 89 2013-05-29 Andreas Kling <akling@apple.com> 2 90 -
trunk/Source/WebCore/css/BasicShapeFunctions.cpp
r148645 r150904 95 95 break; 96 96 } 97 case BasicShape::BASIC_SHAPE_INSET_RECTANGLE: { 98 const BasicShapeInsetRectangle* rectangle = static_cast<const BasicShapeInsetRectangle*>(basicShape); 99 RefPtr<CSSBasicShapeInsetRectangle> rectangleValue = CSSBasicShapeInsetRectangle::create(); 100 101 rectangleValue->setTop(cssValuePool().createValue(rectangle->top())); 102 rectangleValue->setRight(cssValuePool().createValue(rectangle->right())); 103 rectangleValue->setBottom(cssValuePool().createValue(rectangle->bottom())); 104 rectangleValue->setLeft(cssValuePool().createValue(rectangle->left())); 105 if (!rectangle->cornerRadiusX().isUndefined()) { 106 rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX())); 107 if (!rectangle->cornerRadiusY().isUndefined()) 108 rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY())); 109 } 110 111 basicShapeValue = rectangleValue.release(); 112 break; 113 } 97 114 default: 98 115 break; … … 162 179 break; 163 180 } 181 case CSSBasicShape::CSS_BASIC_SHAPE_INSET_RECTANGLE: { 182 const CSSBasicShapeInsetRectangle* rectValue = static_cast<const CSSBasicShapeInsetRectangle *>(basicShapeValue); 183 RefPtr<BasicShapeInsetRectangle> rect = BasicShapeInsetRectangle::create(); 184 185 rect->setTop(convertToLength(style, rootStyle, rectValue->top())); 186 rect->setRight(convertToLength(style, rootStyle, rectValue->right())); 187 rect->setBottom(convertToLength(style, rootStyle, rectValue->bottom())); 188 rect->setLeft(convertToLength(style, rootStyle, rectValue->left())); 189 if (rectValue->radiusX()) { 190 rect->setCornerRadiusX(convertToLength(style, rootStyle, rectValue->radiusX())); 191 if (rectValue->radiusY()) 192 rect->setCornerRadiusY(convertToLength(style, rootStyle, rectValue->radiusY())); 193 } 194 basicShape = rect.release(); 195 break; 196 } 164 197 default: 165 198 break; -
trunk/Source/WebCore/css/CSSBasicShapes.cpp
r142444 r150904 269 269 #endif 270 270 271 static String buildInsetRectangleString(const String& top, const String& right, const String& bottom, const String& left, const String& radiusX, const String& radiusY) 272 { 273 char opening[] = "inset-rectangle("; 274 char separator[] = ", "; 275 StringBuilder result; 276 // Compute the required capacity in advance to reduce allocations. 277 result.reserveCapacity((sizeof(opening) - 1) + (5 * (sizeof(separator) - 1)) + 1 + top.length() + right.length() + bottom.length() + left.length() + radiusX.length() + radiusY.length()); 278 result.appendLiteral(opening); 279 result.append(top); 280 result.appendLiteral(separator); 281 result.append(right); 282 result.appendLiteral(separator); 283 result.append(bottom); 284 result.appendLiteral(separator); 285 result.append(left); 286 if (!radiusX.isNull()) { 287 result.appendLiteral(separator); 288 result.append(radiusX); 289 if (!radiusY.isNull()) { 290 result.appendLiteral(separator); 291 result.append(radiusY); 292 } 293 } 294 result.append(')'); 295 return result.toString(); 296 } 297 298 String CSSBasicShapeInsetRectangle::cssText() const 299 { 300 return buildInsetRectangleString(m_top->cssText(), 301 m_right->cssText(), 302 m_bottom->cssText(), 303 m_left->cssText(), 304 m_radiusX.get() ? m_radiusX->cssText() : String(), 305 m_radiusY.get() ? m_radiusY->cssText() : String()); 306 } 307 308 bool CSSBasicShapeInsetRectangle::equals(const CSSBasicShape& shape) const 309 { 310 if (shape.type() != CSS_BASIC_SHAPE_INSET_RECTANGLE) 311 return false; 312 313 const CSSBasicShapeInsetRectangle& other = static_cast<const CSSBasicShapeInsetRectangle&>(shape); 314 return compareCSSValuePtr(m_top, other.m_top) 315 && compareCSSValuePtr(m_right, other.m_right) 316 && compareCSSValuePtr(m_bottom, other.m_bottom) 317 && compareCSSValuePtr(m_left, other.m_left) 318 && compareCSSValuePtr(m_radiusX, other.m_radiusX) 319 && compareCSSValuePtr(m_radiusY, other.m_radiusY); 320 } 321 322 #if ENABLE(CSS_VARIABLES) 323 String CSSBasicShapeInsetRectangle::serializeResolvingVariables(const HashMap<AtomicString, String>& variables) const 324 { 325 return buildInsetRectangleString(m_top->serializeResolvingVariables(variables), 326 m_right->serializeResolvingVariables(variables), 327 m_bottom->serializeResolvingVariables(variables), 328 m_left->serializeResolvingVariables(variables), 329 m_radiusX.get() ? m_radiusX->serializeResolvingVariables(variables) : String(), 330 m_radiusY.get() ? m_radiusY->serializeResolvingVariables(variables) : String()); 331 } 332 333 bool CSSBasicShapeInsetRectangle::hasVariableReference() const 334 { 335 return m_top->hasVariableReference() 336 || m_right->hasVariableReference() 337 || m_bottom->hasVariableReference() 338 || m_left->hasVariableReference() 339 || (m_radiusX.get() && m_radiusX->hasVariableReference()) 340 || (m_radiusY.get() && m_radiusY->hasVariableReference()); 341 } 342 #endif 343 271 344 } // namespace WebCore 272 345 -
trunk/Source/WebCore/css/CSSBasicShapes.h
r142444 r150904 45 45 CSS_BASIC_SHAPE_CIRCLE = 2, 46 46 CSS_BASIC_SHAPE_ELLIPSE = 3, 47 CSS_BASIC_SHAPE_POLYGON = 4 47 CSS_BASIC_SHAPE_POLYGON = 4, 48 CSS_BASIC_SHAPE_INSET_RECTANGLE = 5 48 49 }; 49 50 … … 102 103 }; 103 104 105 class CSSBasicShapeInsetRectangle : public CSSBasicShape { 106 public: 107 static PassRefPtr<CSSBasicShapeInsetRectangle> create() { return adoptRef(new CSSBasicShapeInsetRectangle); } 108 109 CSSPrimitiveValue* top() const { return m_top.get(); } 110 CSSPrimitiveValue* right() const { return m_right.get(); } 111 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } 112 CSSPrimitiveValue* left() const { return m_left.get(); } 113 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } 114 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } 115 116 void setTop(PassRefPtr<CSSPrimitiveValue> top) { m_top = top; } 117 void setRight(PassRefPtr<CSSPrimitiveValue> right) { m_right = right; } 118 void setBottom(PassRefPtr<CSSPrimitiveValue> bottom) { m_bottom = bottom; } 119 void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; } 120 void setRadiusX(PassRefPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX; } 121 void setRadiusY(PassRefPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY; } 122 123 virtual Type type() const { return CSS_BASIC_SHAPE_INSET_RECTANGLE; } 124 virtual String cssText() const; 125 virtual bool equals(const CSSBasicShape&) const; 126 127 #if ENABLE(CSS_VARIABLES) 128 virtual String serializeResolvingVariables(const HashMap<AtomicString, String>&) const; 129 virtual bool hasVariableReference() const; 130 #endif 131 132 private: 133 CSSBasicShapeInsetRectangle() { } 134 135 RefPtr<CSSPrimitiveValue> m_right; 136 RefPtr<CSSPrimitiveValue> m_top; 137 RefPtr<CSSPrimitiveValue> m_bottom; 138 RefPtr<CSSPrimitiveValue> m_left; 139 RefPtr<CSSPrimitiveValue> m_radiusX; 140 RefPtr<CSSPrimitiveValue> m_radiusY; 141 }; 142 104 143 class CSSBasicShapeCircle : public CSSBasicShape { 105 144 public: -
trunk/Source/WebCore/css/CSSParser.cpp
r150791 r150904 5138 5138 } 5139 5139 5140 PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeInsetRectangle(CSSParserValueList* args) 5141 { 5142 ASSERT(args); 5143 5144 // inset-rectangle(top, right, bottom, left, [[rx], ry]) 5145 if (args->size() != 7 && args->size() != 9 && args->size() != 11) 5146 return 0; 5147 5148 RefPtr<CSSBasicShapeInsetRectangle> shape = CSSBasicShapeInsetRectangle::create(); 5149 5150 unsigned argumentNumber = 0; 5151 CSSParserValue* argument = args->current(); 5152 while (argument) { 5153 Units unitFlags = FLength | FPercent | FNonNeg; 5154 if (!validUnit(argument, unitFlags)) 5155 return 0; 5156 5157 RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); 5158 ASSERT(argumentNumber < 6); 5159 switch (argumentNumber) { 5160 case 0: 5161 shape->setTop(length); 5162 break; 5163 case 1: 5164 shape->setRight(length); 5165 break; 5166 case 2: 5167 shape->setBottom(length); 5168 break; 5169 case 3: 5170 shape->setLeft(length); 5171 break; 5172 case 4: 5173 shape->setRadiusX(length); 5174 break; 5175 case 5: 5176 shape->setRadiusY(length); 5177 break; 5178 } 5179 argument = args->next(); 5180 if (argument) { 5181 if (!isComma(argument)) 5182 return 0; 5183 5184 argument = args->next(); 5185 } 5186 argumentNumber++; 5187 } 5188 5189 if (argumentNumber < 4) 5190 return 0; 5191 return shape; 5192 } 5193 5140 5194 PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeCircle(CSSParserValueList* args) 5141 5195 { … … 5308 5362 else if (equalIgnoringCase(value->function->name, "polygon(")) 5309 5363 shape = parseBasicShapePolygon(args); 5364 else if (equalIgnoringCase(value->function->name, "inset-rectangle(")) 5365 shape = parseBasicShapeInsetRectangle(args); 5310 5366 5311 5367 if (!shape) -
trunk/Source/WebCore/css/CSSParser.h
r150791 r150904 178 178 PassRefPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueList* args); 179 179 PassRefPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueList* args); 180 PassRefPtr<CSSBasicShape> parseBasicShapeInsetRectangle(CSSParserValueList* args); 180 181 181 182 bool parseFont(bool important); -
trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp
r150387 r150904 47 47 { 48 48 ExclusionShapeValue* shapeValue = renderer->style()->resolvedShapeInside(); 49 return (shapeValue && shapeValue->type() == ExclusionShapeValue::Shape) ? shapeValue->shape() : 0; 49 if (!shapeValue || shapeValue->type() != ExclusionShapeValue::Shape) 50 return false; 51 52 BasicShape* shape = shapeValue->shape(); 53 return shape && shape->type() != BasicShape::BASIC_SHAPE_INSET_RECTANGLE; 50 54 } 51 55 -
trunk/Source/WebCore/rendering/ExclusionShapeOutsideInfo.cpp
r150387 r150904 40 40 { 41 41 ExclusionShapeValue* value = box->style()->shapeOutside(); 42 return (box->isFloatingWithShapeOutside() && value->type() == ExclusionShapeValue::Shape) ? value->shape() : 0; 42 if (!box->isFloatingWithShapeOutside() || value->type() != ExclusionShapeValue::Shape) 43 return false; 44 45 BasicShape* shape = value->shape(); 46 return shape && shape->type() != BasicShape::BASIC_SHAPE_INSET_RECTANGLE; 43 47 } 44 48 -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r134736 r150904 170 170 return result.release(); 171 171 } 172 } 172 173 void BasicShapeInsetRectangle::path(Path& path, const FloatRect& boundingBox) 174 { 175 ASSERT(path.isEmpty()); 176 float left = floatValueForLength(m_left, boundingBox.width()); 177 float top = floatValueForLength(m_top, boundingBox.height()); 178 path.addRoundedRect(FloatRect(left + boundingBox.x(), top + boundingBox.y(), 179 std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0), 180 std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)), 181 FloatSize(m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()), 182 m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height()))); 183 } 184 185 PassRefPtr<BasicShape> BasicShapeInsetRectangle::blend(const BasicShape* other, double progress) const 186 { 187 ASSERT(type() == other->type()); 188 189 const BasicShapeInsetRectangle* o = static_cast<const BasicShapeInsetRectangle*>(other); 190 RefPtr<BasicShapeInsetRectangle> result = BasicShapeInsetRectangle::create(); 191 result->setTop(m_top.blend(o->top(), progress)); 192 result->setRight(m_right.blend(o->right(), progress)); 193 result->setBottom(m_bottom.blend(o->bottom(), progress)); 194 result->setLeft(m_left.blend(o->left(), progress)); 195 if (!m_cornerRadiusX.isUndefined() && !o->cornerRadiusX().isUndefined()) 196 result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress)); 197 if (!m_cornerRadiusY.isUndefined() && !o->cornerRadiusY().isUndefined()) 198 result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress)); 199 return result.release(); 200 } 201 } -
trunk/Source/WebCore/rendering/style/BasicShapes.h
r134679 r150904 50 50 BASIC_SHAPE_CIRCLE = 2, 51 51 BASIC_SHAPE_ELLIPSE = 3, 52 BASIC_SHAPE_POLYGON = 4 52 BASIC_SHAPE_POLYGON = 4, 53 BASIC_SHAPE_INSET_RECTANGLE = 5 53 54 }; 54 55 … … 176 177 Vector<Length> m_values; 177 178 }; 179 180 class BasicShapeInsetRectangle : public BasicShape { 181 public: 182 static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new BasicShapeInsetRectangle); } 183 184 Length top() const { return m_top; } 185 Length right() const { return m_right; } 186 Length bottom() const { return m_bottom; } 187 Length left() const { return m_left; } 188 Length cornerRadiusX() const { return m_cornerRadiusX; } 189 Length cornerRadiusY() const { return m_cornerRadiusY; } 190 191 void setTop(Length top) { m_top = top; } 192 void setRight(Length right) { m_right = right; } 193 void setBottom(Length bottom) { m_bottom = bottom; } 194 void setLeft(Length left) { m_left = left; } 195 void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; } 196 void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; } 197 198 virtual void path(Path&, const FloatRect&) OVERRIDE; 199 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE; 200 201 virtual Type type() const { return BASIC_SHAPE_INSET_RECTANGLE; } 202 private: 203 BasicShapeInsetRectangle() 204 : m_cornerRadiusX(Undefined) 205 , m_cornerRadiusY(Undefined) 206 { } 207 208 Length m_right; 209 Length m_top; 210 Length m_bottom; 211 Length m_left; 212 Length m_cornerRadiusX; 213 Length m_cornerRadiusY; 214 }; 178 215 } 179 216 #endif
Note: See TracChangeset
for help on using the changeset viewer.