[CSS Exclusions] Support outside-shape value on shape-inside
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Nov 2012 22:39:38 +0000 (22:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Nov 2012 22:39:38 +0000 (22:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101108

Patch by Bear Travis <betravis@adobe.com> on 2012-11-20
Reviewed by Dirk Schulze.

Source/WebCore:

Shape-inside can potentially be: 'auto' | 'outside-shape' | <shape> | <url>.
Webkit currently supports the value 'auto' (null) and <shape> (a BasicShape*).
This patch adds support for the value 'outside-shape.' It adds the ExclusionShapeValue
class, which may be any of the three values: 'auto', 'outside-shape', or <shape>.
Bug 102738 tracks adding <url> support.

Modifying existing tests:
LayoutTests/fast/exclusions/parsing-wrap-shape-inside.html
LayoutTests/fast/exclusions/parsing-wrap-shape-outside.html

* GNUmakefile.list.am: Adding ExclusionShapeValue.h to the build files.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
(WebCore):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Modifying code to use
ExclusionShapeValue* rather than the previous BasicShape* values.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Handle the outside-shape value.
* css/CSSValueKeywords.in: Adding outside-shape value.
* css/StyleBuilder.cpp:
(WebCore):
(WebCore::ApplyPropertyExclusionShape::setValue): Modify code to use
ExclusionShapeValue* rather than BasicShape*.
(WebCore::ApplyPropertyExclusionShape::applyValue): Ditto.
(WebCore::ApplyPropertyExclusionShape::createHandler): Ditto.
* page/animation/CSSPropertyAnimation.cpp: Ditto.
(WebCore::blendFunc): Ditto.
(WebCore::PropertyWrapperExclusionShape::PropertyWrapperExclusionShape): Ditto.
(WebCore::CSSPropertyAnimation::ensurePropertyMap): Ditto.
* rendering/ExclusionShapeInsideInfo.cpp:
(WebCore::ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock):
Ditto.
(WebCore::ExclusionShapeInsideInfo::computeShapeSize): Ditto.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Ditto.
* rendering/RenderBlock.h:
(RenderBlock):
* rendering/style/ExclusionShapeValue.h: Added.
(WebCore):
(ExclusionShapeValue): New type to represent the possible values of shape-inside
and shape-outside. Only shape-inside can have a value of 'outside-shape.'
(WebCore::ExclusionShapeValue::~ExclusionShapeValue):
(WebCore::ExclusionShapeValue::type): Returns the value type.
(WebCore::ExclusionShapeValue::shape): Returns <shape> value's BasicShape*.
(WebCore::ExclusionShapeValue::operator==):
(WebCore::ExclusionShapeInfo::createShapeValue):
(WebCore::ExclusionShapeInfo::createOutsideValue):
(WebCore::ExclusionShapeValue::ExclusionShapeValue):
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.h:
(StyleRareNonInheritedData):

LayoutTests:

Adding tests to make sure the 'outside-shape' value properly applies only to the
shape-inside property.

* fast/exclusions/parsing-wrap-shape-inside-expected.txt:
* fast/exclusions/parsing-wrap-shape-outside-expected.txt:
* fast/exclusions/script-tests/parsing-wrap-shape-inside.js:
* fast/exclusions/script-tests/parsing-wrap-shape-outside.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135314 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/exclusions/parsing-wrap-shape-inside-expected.txt
LayoutTests/fast/exclusions/parsing-wrap-shape-outside-expected.txt
LayoutTests/fast/exclusions/script-tests/parsing-wrap-shape-inside.js
LayoutTests/fast/exclusions/script-tests/parsing-wrap-shape-outside.js
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/style/ExclusionShapeValue.h [new file with mode: 0644]
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.h

index ed9f972371c668f1d686e0456430f429ac52c269..b425d8ee906c8408f2d37964b49d9eca0b4150bb 100644 (file)
@@ -1,3 +1,18 @@
+2012-11-20  Bear Travis  <betravis@adobe.com>
+
+        [CSS Exclusions] Support outside-shape value on shape-inside
+        https://bugs.webkit.org/show_bug.cgi?id=101108
+
+        Reviewed by Dirk Schulze.
+
+        Adding tests to make sure the 'outside-shape' value properly applies only to the
+        shape-inside property.
+
+        * fast/exclusions/parsing-wrap-shape-inside-expected.txt:
+        * fast/exclusions/parsing-wrap-shape-outside-expected.txt:
+        * fast/exclusions/script-tests/parsing-wrap-shape-inside.js:
+        * fast/exclusions/script-tests/parsing-wrap-shape-outside.js:
+
 2012-11-20  Jian Li  <jianli@chromium.org>
 
         Unreviewed. Updated chromium test expectations.
index 7c42ec53e3f929fe91edddaffe3c2d1c11077569..bc8e6746d758cdc8c454c84aca82881ff72b2a97 100644 (file)
@@ -5,6 +5,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS testCSSText("auto") is "auto"
 PASS testComputedStyle("auto") is "auto"
+PASS testCSSText("outside-shape") is "outside-shape"
+PASS testComputedStyle("outside-shape") is "outside-shape"
 PASS testCSSText("rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
 PASS testComputedStyle("rectangle(10px, 20px, 30px, 40px)") is "rectangle(10px, 20px, 30px, 40px)"
 PASS testCSSText("rectangle(10px, 20px, 30px, 40px, 5px)") is "rectangle(10px, 20px, 30px, 40px, 5px)"
@@ -22,6 +24,7 @@ PASS testComputedStyle("polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)") is "
 PASS testCSSText("polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS testComputedStyle("polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)") is "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)"
 PASS testNotInherited("auto", "rectangle(10px, 20px, 30px, 40px)") is "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"
+PASS testNotInherited("outside-shape", "rectangle(10px, 20px, 30px, 40px)") is "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px)"
 PASS testNotInherited("rectangle(10px, 20px, 30px, 40px)", "initial") is "parent: rectangle(10px, 20px, 30px, 40px), child: auto"
 PASS testNotInherited("rectangle(10px, 20px, 30px, 40px)", "") is "parent: rectangle(10px, 20px, 30px, 40px), child: auto"
 PASS testNotInherited("rectangle(10px, 20px, 30px, 40px)", "inherit") is "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)"
index 301a5d9690b4e31bf00e6892acf5de5eaa397bbc..6c5b55ed383ef2b75cc77c4efd181f595a0882d9 100644 (file)
@@ -31,6 +31,8 @@ PASS testCSSText("calc()") is ""
 PASS testComputedStyle("calc()") is "auto"
 PASS testCSSText("none") is ""
 PASS testComputedStyle("none") is "auto"
+PASS testCSSText("outside-shape") is ""
+PASS testComputedStyle("outside-shape") is "auto"
 PASS testCSSText("rectangle()") is ""
 PASS testComputedStyle("rectangle()") is "auto"
 PASS testCSSText("rectangle(10px)") is ""
index 9c5d301fd812eb1ad0660d9cd41df5672ca8c964..43928febda1c2cc056307b72cb80eefa48af17aa 100644 (file)
@@ -58,6 +58,7 @@ function negative_test(value) {
 // positive tests
 
 test("auto", "auto");
+test("outside-shape", "outside-shape");
 test("rectangle(10px, 20px, 30px, 40px)", "rectangle(10px, 20px, 30px, 40px)");
 test("rectangle(10px, 20px, 30px, 40px, 5px)", "rectangle(10px, 20px, 30px, 40px, 5px)");
 test("rectangle(10px, 20px, 30px, 40px, 5px, 10px)", "rectangle(10px, 20px, 30px, 40px, 5px, 10px)");
@@ -71,6 +72,7 @@ test("polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)", "polygon(evenodd, 10px
 test("polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)");
 
 shouldBeEqualToString('testNotInherited("auto", "rectangle(10px, 20px, 30px, 40px)")', "parent: auto, child: rectangle(10px, 20px, 30px, 40px)");
+shouldBeEqualToString('testNotInherited("outside-shape", "rectangle(10px, 20px, 30px, 40px)")', "parent: outside-shape, child: rectangle(10px, 20px, 30px, 40px)");
 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "initial")', "parent: rectangle(10px, 20px, 30px, 40px), child: auto");
 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "")', "parent: rectangle(10px, 20px, 30px, 40px), child: auto");
 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "inherit")', "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20px, 30px, 40px)");
index 5b1d67e3e2910942b8b980c09ddcb8686efbb850..162cd6d2bba2d8a81777ecd2eaa2fd46f1327477 100644 (file)
@@ -81,6 +81,7 @@ shouldBeEqualToString('testNotInherited("auto", "inherit")', "parent: auto, chil
 
 negative_test("calc()");
 negative_test("none");
+negative_test("outside-shape");
 
 negative_test("rectangle()");
 negative_test("rectangle(10px)");
index f8fbc748db5c88651c48eec3292e0d5243bcf4f0..f851ded5a26b37c95f9a0db23236edee70935e53 100644 (file)
@@ -1,3 +1,65 @@
+2012-11-20  Bear Travis  <betravis@adobe.com>
+
+        [CSS Exclusions] Support outside-shape value on shape-inside
+        https://bugs.webkit.org/show_bug.cgi?id=101108
+
+        Reviewed by Dirk Schulze.
+
+        Shape-inside can potentially be: 'auto' | 'outside-shape' | <shape> | <url>.
+        Webkit currently supports the value 'auto' (null) and <shape> (a BasicShape*).
+        This patch adds support for the value 'outside-shape.' It adds the ExclusionShapeValue
+        class, which may be any of the three values: 'auto', 'outside-shape', or <shape>.
+        Bug 102738 tracks adding <url> support.
+
+        Modifying existing tests:
+        LayoutTests/fast/exclusions/parsing-wrap-shape-inside.html
+        LayoutTests/fast/exclusions/parsing-wrap-shape-outside.html
+
+        * GNUmakefile.list.am: Adding ExclusionShapeValue.h to the build files.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        (WebCore):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Modifying code to use
+        ExclusionShapeValue* rather than the previous BasicShape* values.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue): Handle the outside-shape value.
+        * css/CSSValueKeywords.in: Adding outside-shape value.
+        * css/StyleBuilder.cpp:
+        (WebCore):
+        (WebCore::ApplyPropertyExclusionShape::setValue): Modify code to use
+        ExclusionShapeValue* rather than BasicShape*.
+        (WebCore::ApplyPropertyExclusionShape::applyValue): Ditto.
+        (WebCore::ApplyPropertyExclusionShape::createHandler): Ditto.
+        * page/animation/CSSPropertyAnimation.cpp: Ditto.
+        (WebCore::blendFunc): Ditto.
+        (WebCore::PropertyWrapperExclusionShape::PropertyWrapperExclusionShape): Ditto.
+        (WebCore::CSSPropertyAnimation::ensurePropertyMap): Ditto.
+        * rendering/ExclusionShapeInsideInfo.cpp:
+        (WebCore::ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock):
+        Ditto.
+        (WebCore::ExclusionShapeInsideInfo::computeShapeSize): Ditto.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Ditto.
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+        * rendering/style/ExclusionShapeValue.h: Added.
+        (WebCore):
+        (ExclusionShapeValue): New type to represent the possible values of shape-inside
+        and shape-outside. Only shape-inside can have a value of 'outside-shape.'
+        (WebCore::ExclusionShapeValue::~ExclusionShapeValue):
+        (WebCore::ExclusionShapeValue::type): Returns the value type.
+        (WebCore::ExclusionShapeValue::shape): Returns <shape> value's BasicShape*.
+        (WebCore::ExclusionShapeValue::operator==):
+        (WebCore::ExclusionShapeInfo::createShapeValue):
+        (WebCore::ExclusionShapeInfo::createOutsideValue):
+        (WebCore::ExclusionShapeValue::ExclusionShapeValue):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareNonInheritedData.h:
+        (StyleRareNonInheritedData):
+
 2012-11-20  Alpha Lam  <hclam@chromium.org>
 
         [chromium] Make lazy image decoding thread-safe
index fea7efc9b52fb23e15a34521edb343cf7d19017c..1e7ac1d5bccbe538f30f1acd620dd9c8cc2cd1fe 100644 (file)
@@ -4437,6 +4437,7 @@ webcore_sources += \
        Source/WebCore/rendering/style/CursorData.h \
        Source/WebCore/rendering/style/CursorList.h \
        Source/WebCore/rendering/style/DataRef.h \
+       Source/WebCore/rendering/style/ExclusionShapeValue.h \
        Source/WebCore/rendering/style/FillLayer.cpp \
        Source/WebCore/rendering/style/FillLayer.h \
        Source/WebCore/rendering/style/GridPosition.h \
index de10e1c39f115ce0c6420f01b0a1d30c249a94f1..f66918086e13ac5c65a1be9ac20c6321f5e694dc 100644 (file)
@@ -2446,6 +2446,7 @@ HEADERS += \
     rendering/style/CounterDirectives.h \
     rendering/style/CursorData.h \
     rendering/style/CursorList.h \
+    rendering/style/ExclusionShapeValue.h \
     rendering/style/FillLayer.h \
     rendering/style/KeyframeList.h \
     rendering/style/NinePieceImage.h \
index 4029ee8ba8fba3e79a016b2185f0473fe03f70e3..a8b3fedb64225efa449a8a20781f4838976b45b8 100644 (file)
             'rendering/style/CursorData.h',
             'rendering/style/CursorList.h',
             'rendering/style/DataRef.h',
+            'rendering/style/ExclusionShapeValue.h',
             'rendering/style/FillLayer.h',
             'rendering/style/GridPosition.h',
             'rendering/style/LineClampValue.h',
index d018789fcb114967a40dc5a89ff82dd489fcbda6..e0048403dc3e922ccea8239159af5611fbcf71cf 100755 (executable)
                                        RelativePath="..\rendering\style\DataRef.h"
                                        >
                                </File>
+                               <File
+                                   RelativePath="..\rendering\style\ExclusionShapeValue.h"
+                                   >
+                               </File>
                                <File
                                        RelativePath="..\rendering\style\FillLayer.cpp"
                                        >
index 0aa125c4f8919c621604bdb62816ed7f7c8af161..c7bffea02396fbc93efa1c15dc4ee010fe36c2c0 100644 (file)
                FD06DFA5134A4DEF006F5D7D /* DefaultAudioDestinationNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD06DFA3134A4DEF006F5D7D /* DefaultAudioDestinationNode.cpp */; };
                FD06DFA6134A4DEF006F5D7D /* DefaultAudioDestinationNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD06DFA4134A4DEF006F5D7D /* DefaultAudioDestinationNode.h */; };
                FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */ = {isa = PBXBuildFile; fileRef = FD1660A413787C6D001FFA7B /* DenormalDisabler.h */; };
+               FD1AF1501656F15100C6D4F7 /* ExclusionShapeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = FD1AF14E1656F12100C6D4F7 /* ExclusionShapeValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FD23A12513F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD23A12313F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp */; };
                FD23A12613F5FA5900F67001 /* JSMediaElementAudioSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD23A12413F5FA5900F67001 /* JSMediaElementAudioSourceNode.h */; };
                FD2DBF1212B048A300ED98C6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD2DBF0E12B048A300ED98C6 /* Accelerate.framework */; };
                FD06DFA3134A4DEF006F5D7D /* DefaultAudioDestinationNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DefaultAudioDestinationNode.cpp; sourceTree = "<group>"; };
                FD06DFA4134A4DEF006F5D7D /* DefaultAudioDestinationNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultAudioDestinationNode.h; sourceTree = "<group>"; };
                FD1660A413787C6D001FFA7B /* DenormalDisabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DenormalDisabler.h; sourceTree = "<group>"; };
+               FD1AF14E1656F12100C6D4F7 /* ExclusionShapeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExclusionShapeValue.h; path = style/ExclusionShapeValue.h; sourceTree = "<group>"; };
                FD23A12313F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaElementAudioSourceNode.cpp; sourceTree = "<group>"; };
                FD23A12413F5FA5900F67001 /* JSMediaElementAudioSourceNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaElementAudioSourceNode.h; sourceTree = "<group>"; };
                FD2DBF0E12B048A300ED98C6 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; };
                                BC2272A10E82E87C00E7F975 /* CursorData.h */,
                                BC2272AC0E82E8F300E7F975 /* CursorList.h */,
                                BC22746E0E83664500E7F975 /* DataRef.h */,
+                               FD1AF14E1656F12100C6D4F7 /* ExclusionShapeValue.h */,
                                BC5EB69C0E81DAEB00B25965 /* FillLayer.cpp */,
                                BC5EB69D0E81DAEB00B25965 /* FillLayer.h */,
                                A12705C21656BD6500C2E27C /* GridPosition.h */,
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               FD1AF1501656F15100C6D4F7 /* ExclusionShapeValue.h in Headers */,
                                BC7FA6210D1F0CBD00DB22A9 /* DynamicNodeList.h in Headers */,
                                A81369DA097374F600D74463 /* HTMLOptionsCollection.h in Headers */,
                                A81369D8097374F600D74463 /* HTMLSelectElement.h in Headers */,
index f30d917e003a77af739aed523e928ace292709cf..b127aa96a5fec6922f255fa4e3f96c63d8a1ce25 100644 (file)
 #include "WebKitFontFamilyNames.h"
 #include <wtf/text/StringBuilder.h>
 
+#if ENABLE(CSS_EXCLUSIONS)
+#include "ExclusionShapeValue.h"
+#endif
+
 #if ENABLE(CSS_SHADERS)
 #include "CustomFilterArrayParameter.h"
 #include "CustomFilterNumberParameter.h"
@@ -2504,11 +2508,15 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
         case CSSPropertyWebkitShapeInside:
             if (!style->shapeInside())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
-            return valueForBasicShape(style->shapeInside());
+            else if (style->shapeInside()->type() == ExclusionShapeValue::OUTSIDE)
+                return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
+            ASSERT(style->shapeInside()->type() == ExclusionShapeValue::SHAPE);
+            return valueForBasicShape(style->shapeInside()->shape());
         case CSSPropertyWebkitShapeOutside:
             if (!style->shapeOutside())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
-            return valueForBasicShape(style->shapeOutside());
+            ASSERT(style->shapeOutside()->type() == ExclusionShapeValue::SHAPE);
+            return valueForBasicShape(style->shapeOutside()->shape());
         case CSSPropertyWebkitWrapThrough:
             return cssValuePool().createValue(style->wrapThrough());
 #endif
index 9b2f7085711b6fa4967cbbef8c46e5362e5c11ae..d58c57b7bf17a07bab88681bb24af48ec8de94b2 100644 (file)
@@ -2735,6 +2735,8 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
             return false;
         if (id == CSSValueAuto)
             validPrimitive = true;
+        else if (propId == CSSPropertyWebkitShapeInside && id == CSSValueOutsideShape)
+            validPrimitive = true;
         else if (value->unit == CSSParserValue::Function)
             return parseBasicShape(propId, important);
         break;
index 4b9cc6ea6fbbfe8f74555dad475982c5b3919cac..10ba6eae7b558cf2b3c2422c4abb2a3e572b3210 100644 (file)
@@ -914,9 +914,11 @@ off
 optimizeQuality
 -webkit-optimize-contrast
 
-// -webkit-wrap-shape
+// -webkit-shape-inside
+// -webkit-shape-outside
 nonzero
 evenodd
+outside-shape
 
 // -webkit-region-overflow
 // auto
index ed88640a48ae3749ba661a587326e0e0b3ce4d9d..968b96f8476c5943156d7933775d73d2075af290 100644 (file)
 #include <wtf/StdLibExtras.h>
 #include <wtf/UnusedParam.h>
 
+#if ENABLE(CSS_EXCLUSIONS)
+#include "ExclusionShapeValue.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -1716,25 +1720,28 @@ public:
 };
 
 #if ENABLE(CSS_EXCLUSIONS)
-template <BasicShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<BasicShape>), BasicShape* (*initialFunction)()>
+template <ExclusionShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ExclusionShapeValue>), ExclusionShapeValue* (*initialFunction)()>
 class ApplyPropertyExclusionShape {
 public:
-    static void setValue(RenderStyle* style, PassRefPtr<BasicShape> value) { (style->*setterFunction)(value); }
+    static void setValue(RenderStyle* style, PassRefPtr<ExclusionShapeValue> value) { (style->*setterFunction)(value); }
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (value->isPrimitiveValue()) {
             CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
             if (primitiveValue->getIdent() == CSSValueAuto)
                 setValue(styleResolver->style(), 0);
+            // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
+            else if (primitiveValue->getIdent() == CSSValueOutsideShape)
+                setValue(styleResolver->style(), ExclusionShapeValue::createOutsideValue());
             else if (primitiveValue->isShape()) {
-                RefPtr<BasicShape> shape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue());
+                RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createShapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
                 setValue(styleResolver->style(), shape.release());
             }
         }
     }
     static PropertyHandler createHandler()
     {
-        PropertyHandler handler = ApplyPropertyDefaultBase<BasicShape*, getterFunction, PassRefPtr<BasicShape>, setterFunction, BasicShape*, initialFunction>::createHandler();
+        PropertyHandler handler = ApplyPropertyDefaultBase<ExclusionShapeValue*, getterFunction, PassRefPtr<ExclusionShapeValue>, setterFunction, ExclusionShapeValue*, initialFunction>::createHandler();
         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     }
 };
index b763b56659bb3b1cf2260566f2d4e94cac6b33ed..2504da4041d015de57bcbd8abfc93f4029042753 100644 (file)
@@ -143,12 +143,19 @@ static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, Clip
 }
 
 #if ENABLE(CSS_EXCLUSIONS)
-static inline PassRefPtr<BasicShape> blendFunc(const AnimationBase*, BasicShape* from, BasicShape* to, double progress)
+static inline PassRefPtr<ExclusionShapeValue> blendFunc(const AnimationBase*, ExclusionShapeValue* from, ExclusionShapeValue* to, double progress)
 {
-    if (!from->canBlend(to))
+    // FIXME Bug 102723: Shape-inside should be able to animate a value of 'outside-shape' when shape-outside is set to a BasicShape
+    if (from->type() != ExclusionShapeValue::SHAPE || to->type() != ExclusionShapeValue::SHAPE)
         return to;
 
-    return to->blend(from, progress);
+    const BasicShape* fromShape = from->shape();
+    const BasicShape* toShape = to->shape();
+
+    if (!fromShape->canBlend(toShape))
+        return to;
+
+    return ExclusionShapeValue::createShapeValue(toShape->blend(fromShape, progress));
 }
 #endif
 
@@ -404,10 +411,10 @@ public:
 };
 
 #if ENABLE(CSS_EXCLUSIONS)
-class PropertyWrapperBasicShape : public RefCountedPropertyWrapper<BasicShape> {
+class PropertyWrapperExclusionShape : public RefCountedPropertyWrapper<ExclusionShapeValue> {
 public:
-    PropertyWrapperBasicShape(CSSPropertyID prop, BasicShape* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<BasicShape>))
-        : RefCountedPropertyWrapper<BasicShape>(prop, getter, setter)
+    PropertyWrapperExclusionShape(CSSPropertyID prop, ExclusionShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ExclusionShapeValue>))
+        : RefCountedPropertyWrapper<ExclusionShapeValue>(prop, getter, setter)
     {
     }
 };
@@ -1162,7 +1169,7 @@ void CSSPropertyAnimation::ensurePropertyMap()
     gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipPath, &RenderStyle::clipPath, &RenderStyle::setClipPath));
 
 #if ENABLE(CSS_EXCLUSIONS)
-    gPropertyWrappers->append(new PropertyWrapperBasicShape(CSSPropertyWebkitShapeInside, &RenderStyle::shapeInside, &RenderStyle::setShapeInside));
+    gPropertyWrappers->append(new PropertyWrapperExclusionShape(CSSPropertyWebkitShapeInside, &RenderStyle::shapeInside, &RenderStyle::setShapeInside));
 #endif
 
     gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitColumnRuleColor, MaybeInvalidColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor));
index b7830f10ef6be4c3923078353c4d0987d771a0df..934e3f299f403a410d6f5869b46674faef3322a6 100644 (file)
@@ -72,7 +72,8 @@ ExclusionShapeInsideInfo* ExclusionShapeInsideInfo::exclusionShapeInsideInfoForR
 bool ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock(const RenderBlock* block)
 {
     // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
-    BasicShape* shape = block->style()->shapeInside();
+    ExclusionShapeValue* shapeValue = block->style()->shapeInside();
+    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
     return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON);
 }
 
@@ -93,7 +94,9 @@ void ExclusionShapeInsideInfo::computeShapeSize(LayoutUnit logicalWidth, LayoutU
     m_logicalHeight = logicalHeight;
 
     // FIXME: Bug 89993: The wrap shape may come from the parent object
-    BasicShape* shape = m_block->style()->shapeInside();
+    ExclusionShapeValue* shapeValue = m_block->style()->shapeInside();
+    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
+
     ASSERT(shape);
 
     m_shape = ExclusionShape::createExclusionShape(shape, logicalWidth, logicalHeight, m_block->style()->writingMode());
index 4a5e8933d0a0aff94ac7364974bdc40965032434..84f7b3c61bc92b57e665a3af47c42efb73df4546 100644 (file)
@@ -1398,7 +1398,7 @@ void RenderBlock::layout()
 }
 
 #if ENABLE(CSS_EXCLUSIONS)
-void RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange(const BasicShape* shapeInside, const BasicShape* oldShapeInside)
+void RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange(const ExclusionShapeValue* shapeInside, const ExclusionShapeValue* oldShapeInside)
 {
     // FIXME: A future optimization would do a deep comparison for equality.
     if (shapeInside == oldShapeInside)
index 55a001f61c4cb3a122eae9da78cffa20c9674227..a5566ed7766b4461a64c07a5162acdcb240c848d 100644 (file)
@@ -36,6 +36,7 @@
 
 #if ENABLE(CSS_EXCLUSIONS)
 #include "ExclusionShapeInsideInfo.h"
+#include "ExclusionShapeValue.h"
 #endif
 
 namespace WebCore {
@@ -521,7 +522,7 @@ protected:
 private:
 #if ENABLE(CSS_EXCLUSIONS)
     void computeExclusionShapeSize();
-    void updateExclusionShapeInsideInfoAfterStyleChange(const BasicShape*, const BasicShape* oldWrapShape);
+    void updateExclusionShapeInsideInfoAfterStyleChange(const ExclusionShapeValue*, const ExclusionShapeValue* oldExclusionShape);
 #endif
     virtual RenderObjectChildList* virtualChildren() { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
diff --git a/Source/WebCore/rendering/style/ExclusionShapeValue.h b/Source/WebCore/rendering/style/ExclusionShapeValue.h
new file mode 100644 (file)
index 0000000..5a533af
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ExclusionShapeValue_h
+#define ExclusionShapeValue_h
+
+#include "BasicShapes.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class ExclusionShapeValue : public RefCounted<ExclusionShapeValue> {
+public:
+    enum ExclusionShapeValueType {
+        // The AUTO value is defined by a null ExclusionShapeValue*
+        SHAPE,
+        OUTSIDE
+    };
+
+    static PassRefPtr<ExclusionShapeValue> createShapeValue(PassRefPtr<BasicShape> shape)
+    {
+        return adoptRef(new ExclusionShapeValue(shape));
+    }
+
+    static PassRefPtr<ExclusionShapeValue> createOutsideValue()
+    {
+        return adoptRef(new ExclusionShapeValue(OUTSIDE));
+    }
+
+    ExclusionShapeValueType type() const { return m_type; }
+    BasicShape* shape() const { return m_shape.get(); }
+    bool operator==(const ExclusionShapeValue& other) const { return type() == other.type(); }
+
+private:
+    ExclusionShapeValue(PassRefPtr<BasicShape> shape) : m_type(SHAPE), m_shape(shape) { }
+    ExclusionShapeValue(ExclusionShapeValueType type) : m_type(type) { }
+    ExclusionShapeValueType m_type;
+    RefPtr<BasicShape> m_shape;
+};
+
+}
+
+#endif
index 40c32ddcca83e69d3e258b5f035708f243073ced..31996fa05abb5cd0589411a56facf3c7073c5ec0 100644 (file)
@@ -34,6 +34,7 @@
 #include "ColorSpace.h"
 #include "CounterDirectives.h"
 #include "DataRef.h"
+#include "ExclusionShapeValue.h"
 #include "FontBaseline.h"
 #include "FontDescription.h"
 #include "GraphicsTypes.h"
@@ -1455,22 +1456,24 @@ public:
     void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); }
 #endif
 
-    void setShapeInside(PassRefPtr<BasicShape> shape)
+    void setShapeInside(PassRefPtr<ExclusionShapeValue> value)
     {
-        if (rareNonInheritedData->m_shapeInside != shape)
-            rareNonInheritedData.access()->m_shapeInside = shape;
+        if (rareNonInheritedData->m_shapeInside == value)
+            return;
+        rareNonInheritedData.access()->m_shapeInside = value;
     }
-    BasicShape* shapeInside() const { return rareNonInheritedData->m_shapeInside.get(); }
+    ExclusionShapeValue* shapeInside() const { return rareNonInheritedData->m_shapeInside.get(); }
 
-    void setShapeOutside(PassRefPtr<BasicShape> shape)
+    void setShapeOutside(PassRefPtr<ExclusionShapeValue> value)
     {
-        if (rareNonInheritedData->m_shapeOutside != shape)
-            rareNonInheritedData.access()->m_shapeOutside = shape;
+        if (rareNonInheritedData->m_shapeOutside == value)
+            return;
+        rareNonInheritedData.access()->m_shapeOutside = value;
     }
-    BasicShape* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
+    ExclusionShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
 
-    static BasicShape* initialShapeInside() { return 0; }
-    static BasicShape* initialShapeOutside() { return 0; }
+    static ExclusionShapeValue* initialShapeInside() { return 0; }
+    static ExclusionShapeValue* initialShapeOutside() { return 0; }
 
     void setClipPath(PassRefPtr<ClipPathOperation> operation)
     {
index 4186bb19f6a936327e301184b1414423d9dce79b..c4ac0f6f38f89211ec084398d19f528755f0dd8b 100644 (file)
@@ -30,6 +30,7 @@
 #include "CounterDirectives.h"
 #include "CursorData.h"
 #include "DataRef.h"
+#include "ExclusionShapeValue.h"
 #include "FillLayer.h"
 #include "LineClampValue.h"
 #include "NinePieceImage.h"
@@ -137,8 +138,8 @@ public:
 
     LengthSize m_pageSize;
 
-    RefPtr<BasicShape> m_shapeInside;
-    RefPtr<BasicShape> m_shapeOutside;
+    RefPtr<ExclusionShapeValue> m_shapeInside;
+    RefPtr<ExclusionShapeValue> m_shapeOutside;
     Length m_shapeMargin;
     Length m_shapePadding;