Changeset 90863 in webkit


Ignore:
Timestamp:
Jul 12, 2011 3:34:04 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Patch by Alexandru Chiculita <Alexandru Chiculita> on 2011-07-12
Reviewed by David Hyatt.

[CSS Exclusions] Parse wrap-shape property
https://bugs.webkit.org/show_bug.cgi?id=61726

Source/WebCore:

Parsing wrap-shape: rect, circle, ellipse and polygon.
Moved WindRule from Path.h to it's own file.

Test: fast/exclusions/parsing-wrap-shape.html

  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseWrapShapeRect):
(WebCore::CSSParser::parseWrapShapeCircle):
(WebCore::CSSParser::parseWrapShapeEllipse):
(WebCore::CSSParser::parseWrapShapePolygon):
(WebCore::CSSParser::parseWrapShape):

  • css/CSSParser.h:
  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::init):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::cssText):

  • css/CSSPrimitiveValue.h:

(WebCore::CSSPrimitiveValue::getShapeValue):

  • css/CSSPropertyNames.in:
  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • css/CSSValueKeywords.in:
  • css/CSSWrapShapes.cpp: Added.

(WebCore::CSSWrapShapeRect::cssText):
(WebCore::CSSWrapShapeCircle::cssText):
(WebCore::CSSWrapShapeEllipse::cssText):
(WebCore::CSSWrapShapePolygon::cssText):

  • css/CSSWrapShapes.h: Added.

(WebCore::CSSWrapShape::~CSSWrapShape):
(WebCore::CSSWrapShape::CSSWrapShape):
(WebCore::CSSWrapShapeRect::create):
(WebCore::CSSWrapShapeRect::left):
(WebCore::CSSWrapShapeRect::top):
(WebCore::CSSWrapShapeRect::width):
(WebCore::CSSWrapShapeRect::height):
(WebCore::CSSWrapShapeRect::radiusX):
(WebCore::CSSWrapShapeRect::radiusY):
(WebCore::CSSWrapShapeRect::setLeft):
(WebCore::CSSWrapShapeRect::setTop):
(WebCore::CSSWrapShapeRect::setWidth):
(WebCore::CSSWrapShapeRect::setHeight):
(WebCore::CSSWrapShapeRect::setRadiusX):
(WebCore::CSSWrapShapeRect::setRadiusY):
(WebCore::CSSWrapShapeRect::type):
(WebCore::CSSWrapShapeRect::CSSWrapShapeRect):
(WebCore::CSSWrapShapeCircle::create):
(WebCore::CSSWrapShapeCircle::left):
(WebCore::CSSWrapShapeCircle::top):
(WebCore::CSSWrapShapeCircle::radius):
(WebCore::CSSWrapShapeCircle::setLeft):
(WebCore::CSSWrapShapeCircle::setTop):
(WebCore::CSSWrapShapeCircle::setRadius):
(WebCore::CSSWrapShapeCircle::type):
(WebCore::CSSWrapShapeCircle::CSSWrapShapeCircle):
(WebCore::CSSWrapShapeEllipse::create):
(WebCore::CSSWrapShapeEllipse::left):
(WebCore::CSSWrapShapeEllipse::top):
(WebCore::CSSWrapShapeEllipse::radiusX):
(WebCore::CSSWrapShapeEllipse::radiusY):
(WebCore::CSSWrapShapeEllipse::setLeft):
(WebCore::CSSWrapShapeEllipse::setTop):
(WebCore::CSSWrapShapeEllipse::setRadiusX):
(WebCore::CSSWrapShapeEllipse::setRadiusY):
(WebCore::CSSWrapShapeEllipse::type):
(WebCore::CSSWrapShapeEllipse::CSSWrapShapeEllipse):
(WebCore::CSSWrapShapePolygon::create):
(WebCore::CSSWrapShapePolygon::appendPoint):
(WebCore::CSSWrapShapePolygon::getXAt):
(WebCore::CSSWrapShapePolygon::getYAt):
(WebCore::CSSWrapShapePolygon::setWindRule):
(WebCore::CSSWrapShapePolygon::windRule):
(WebCore::CSSWrapShapePolygon::type):
(WebCore::CSSWrapShapePolygon::CSSWrapShapePolygon):

  • css/SVGCSSValueKeywords.in:
  • platform/graphics/Path.h:
  • platform/graphics/WindRule.h: Added.
  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::setWrapShape):
(WebCore::InheritedFlags::wrapShape):
(WebCore::InheritedFlags::initialWrapShape):

  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):

  • rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

  • fast/exclusions/parsing-wrap-shape-expected.txt: Added.
  • fast/exclusions/parsing-wrap-shape.html: Added.
  • fast/exclusions/script-tests/parsing-wrap-shape.js: Added.

(testCSSText):
(testComputedStyle):
(testNotInherited):
(test):
(negative_test):

Location:
trunk
Files:
7 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90856 r90863  
     12011-07-12  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        [CSS Exclusions] Parse wrap-shape property
     6        https://bugs.webkit.org/show_bug.cgi?id=61726
     7
     8        * fast/exclusions/parsing-wrap-shape-expected.txt: Added.
     9        * fast/exclusions/parsing-wrap-shape.html: Added.
     10        * fast/exclusions/script-tests/parsing-wrap-shape.js: Added.
     11        (testCSSText):
     12        (testComputedStyle):
     13        (testNotInherited):
     14        (test):
     15        (negative_test):
     16
    1172011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r90860 r90863  
     12011-07-12  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        [CSS Exclusions] Parse wrap-shape property
     6        https://bugs.webkit.org/show_bug.cgi?id=61726
     7
     8        Parsing wrap-shape: rect, circle, ellipse and polygon.
     9        Moved WindRule from Path.h to it's own file.
     10
     11        Test: fast/exclusions/parsing-wrap-shape.html
     12
     13        * WebCore.vcproj/WebCore.vcproj:
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * css/CSSComputedStyleDeclaration.cpp:
     16        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     17        * css/CSSParser.cpp:
     18        (WebCore::CSSParser::parseValue):
     19        (WebCore::CSSParser::parseWrapShapeRect):
     20        (WebCore::CSSParser::parseWrapShapeCircle):
     21        (WebCore::CSSParser::parseWrapShapeEllipse):
     22        (WebCore::CSSParser::parseWrapShapePolygon):
     23        (WebCore::CSSParser::parseWrapShape):
     24        * css/CSSParser.h:
     25        * css/CSSPrimitiveValue.cpp:
     26        (WebCore::CSSPrimitiveValue::init):
     27        (WebCore::CSSPrimitiveValue::cleanup):
     28        (WebCore::CSSPrimitiveValue::cssText):
     29        * css/CSSPrimitiveValue.h:
     30        (WebCore::CSSPrimitiveValue::getShapeValue):
     31        * css/CSSPropertyNames.in:
     32        * css/CSSStyleSelector.cpp:
     33        (WebCore::CSSStyleSelector::applyProperty):
     34        * css/CSSValueKeywords.in:
     35        * css/CSSWrapShapes.cpp: Added.
     36        (WebCore::CSSWrapShapeRect::cssText):
     37        (WebCore::CSSWrapShapeCircle::cssText):
     38        (WebCore::CSSWrapShapeEllipse::cssText):
     39        (WebCore::CSSWrapShapePolygon::cssText):
     40        * css/CSSWrapShapes.h: Added.
     41        (WebCore::CSSWrapShape::~CSSWrapShape):
     42        (WebCore::CSSWrapShape::CSSWrapShape):
     43        (WebCore::CSSWrapShapeRect::create):
     44        (WebCore::CSSWrapShapeRect::left):
     45        (WebCore::CSSWrapShapeRect::top):
     46        (WebCore::CSSWrapShapeRect::width):
     47        (WebCore::CSSWrapShapeRect::height):
     48        (WebCore::CSSWrapShapeRect::radiusX):
     49        (WebCore::CSSWrapShapeRect::radiusY):
     50        (WebCore::CSSWrapShapeRect::setLeft):
     51        (WebCore::CSSWrapShapeRect::setTop):
     52        (WebCore::CSSWrapShapeRect::setWidth):
     53        (WebCore::CSSWrapShapeRect::setHeight):
     54        (WebCore::CSSWrapShapeRect::setRadiusX):
     55        (WebCore::CSSWrapShapeRect::setRadiusY):
     56        (WebCore::CSSWrapShapeRect::type):
     57        (WebCore::CSSWrapShapeRect::CSSWrapShapeRect):
     58        (WebCore::CSSWrapShapeCircle::create):
     59        (WebCore::CSSWrapShapeCircle::left):
     60        (WebCore::CSSWrapShapeCircle::top):
     61        (WebCore::CSSWrapShapeCircle::radius):
     62        (WebCore::CSSWrapShapeCircle::setLeft):
     63        (WebCore::CSSWrapShapeCircle::setTop):
     64        (WebCore::CSSWrapShapeCircle::setRadius):
     65        (WebCore::CSSWrapShapeCircle::type):
     66        (WebCore::CSSWrapShapeCircle::CSSWrapShapeCircle):
     67        (WebCore::CSSWrapShapeEllipse::create):
     68        (WebCore::CSSWrapShapeEllipse::left):
     69        (WebCore::CSSWrapShapeEllipse::top):
     70        (WebCore::CSSWrapShapeEllipse::radiusX):
     71        (WebCore::CSSWrapShapeEllipse::radiusY):
     72        (WebCore::CSSWrapShapeEllipse::setLeft):
     73        (WebCore::CSSWrapShapeEllipse::setTop):
     74        (WebCore::CSSWrapShapeEllipse::setRadiusX):
     75        (WebCore::CSSWrapShapeEllipse::setRadiusY):
     76        (WebCore::CSSWrapShapeEllipse::type):
     77        (WebCore::CSSWrapShapeEllipse::CSSWrapShapeEllipse):
     78        (WebCore::CSSWrapShapePolygon::create):
     79        (WebCore::CSSWrapShapePolygon::appendPoint):
     80        (WebCore::CSSWrapShapePolygon::getXAt):
     81        (WebCore::CSSWrapShapePolygon::getYAt):
     82        (WebCore::CSSWrapShapePolygon::setWindRule):
     83        (WebCore::CSSWrapShapePolygon::windRule):
     84        (WebCore::CSSWrapShapePolygon::type):
     85        (WebCore::CSSWrapShapePolygon::CSSWrapShapePolygon):
     86        * css/SVGCSSValueKeywords.in:
     87        * platform/graphics/Path.h:
     88        * platform/graphics/WindRule.h: Added.
     89        * rendering/style/RenderStyle.cpp:
     90        (WebCore::RenderStyle::diff):
     91        * rendering/style/RenderStyle.h:
     92        (WebCore::InheritedFlags::setWrapShape):
     93        (WebCore::InheritedFlags::wrapShape):
     94        (WebCore::InheritedFlags::initialWrapShape):
     95        * rendering/style/StyleRareNonInheritedData.cpp:
     96        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     97        (WebCore::StyleRareNonInheritedData::operator==):
     98        * rendering/style/StyleRareNonInheritedData.h:
     99
    11002011-07-12  Simon Fraser  <simon.fraser@apple.com>
    2101
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r90849 r90863  
    2770227702                                </File>
    2770327703                                <File
     27704                                        RelativePath="..\platform\graphics\WindRule.h"
     27705                                        >
     27706                                </File>
     27707                                <File
    2770427708                                        RelativePath="..\platform\graphics\WOFFFileFormat.cpp"
    2770527709                                        >
     
    3289932903                        </File>
    3290032904                        <File
     32905                                RelativePath="..\css\CSSWrapShapes.cpp"
     32906                                >
     32907                        </File>
     32908                        <File
     32909                                RelativePath="..\css\CSSWrapShapes.h"
     32910                                >
     32911                        </File>
     32912                        <File
    3290132913                                RelativePath="..\css\StyleBase.cpp"
    3290232914                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r90849 r90863  
    12901290                4FD8D0F2119C718B002FA825 /* ScriptGCEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */; };
    12911291                4FD8D0F3119C718B002FA825 /* ScriptGCEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */; };
     1292                501BA9E21393CEA000F7ACEB /* CSSWrapShapes.h in Headers */ = {isa = PBXBuildFile; fileRef = 501BA9E11393CEA000F7ACEB /* CSSWrapShapes.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1293                501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 501BAAA813950E2C00F7ACEB /* WindRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1294                50E566D6139E38C500214433 /* CSSWrapShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 501BAAB11395114B00F7ACEB /* CSSWrapShapes.cpp */; };
    12921295                510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12931296                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
     
    78227825                4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptGCEvent.cpp; sourceTree = "<group>"; };
    78237826                4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptGCEvent.h; sourceTree = "<group>"; };
     7827                501BA9E11393CEA000F7ACEB /* CSSWrapShapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSWrapShapes.h; sourceTree = "<group>"; };
     7828                501BAAA813950E2C00F7ACEB /* WindRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindRule.h; sourceTree = "<group>"; };
     7829                501BAAB11395114B00F7ACEB /* CSSWrapShapes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSWrapShapes.cpp; sourceTree = "<group>"; };
    78247830                510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = "<group>"; };
    78257831                510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
     
    1799418000                        isa = PBXGroup;
    1799518001                        children = (
     18002                                501BAAA813950E2C00F7ACEB /* WindRule.h */,
    1799618003                                076F0D0812B8192700C26AA4 /* avfoundation */,
    1799718004                                499B3EC0128CCC1800E726C2 /* ca */,
     
    1911719124                        isa = PBXGroup;
    1911819125                        children = (
     19126                                501BA9E11393CEA000F7ACEB /* CSSWrapShapes.h */,
    1911919127                                93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
    1912019128                                A80E6CDA0A1989CA007FB8C5 /* Counter.h */,
     
    1930919317                                BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */,
    1931019318                                31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */,
     19319                                501BAAB11395114B00F7ACEB /* CSSWrapShapes.cpp */,
    1931119320                        );
    1931219321                        path = css;
     
    2208622095                                8C0E334D138A92C7008DA94F /* LevelDBTransaction.h in Headers */,
    2208722096                                8C0E334F138A92C7008DA94F /* LevelDBWriteBatch.h in Headers */,
     22097                                501BA9E21393CEA000F7ACEB /* CSSWrapShapes.h in Headers */,
     22098                                501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */,
    2208822099                                84730D911248F0B300D3A9C9 /* LightSource.h in Headers */,
    2208922100                                B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */,
     
    2479024801                                FDF6BAF8134A4C9800822920 /* JSOfflineAudioCompletionEvent.cpp in Sources */,
    2479124802                                2E24476813959173004B6C19 /* JSOperationNotAllowedException.cpp in Sources */,
     24803                                50E566D6139E38C500214433 /* CSSWrapShapes.cpp in Sources */,
    2479224804                                A826EC480A1B0CBE00CD1BB6 /* JSOptionConstructor.cpp in Sources */,
    2479324805                                1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */,
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r90642 r90863  
    17761776        case CSSPropertyWebkitTransition:
    17771777            break;
     1778
     1779#if ENABLE(CSS_EXCLUSIONS)
     1780        case CSSPropertyWebkitWrapShape:
     1781            if (!style->wrapShape())
     1782                return primitiveValueCache->createIdentifierValue(CSSValueAuto);
     1783
     1784            return primitiveValueCache->createValue(style->wrapShape());
     1785#endif
     1786
    17781787#if ENABLE(SVG)
    17791788        case CSSPropertyClipPath:
  • trunk/Source/WebCore/css/CSSParser.cpp

    r90642 r90863  
    8383#endif
    8484
     85#if ENABLE(CSS_EXCLUSIONS)
     86#include "CSSWrapShapes.h"
     87#endif
     88
    8589#define YYDEBUG 0
    8690
     
    20772081            return parseLineBoxContain(important);
    20782082        break;
     2083
     2084#if ENABLE(CSS_EXCLUSIONS)
     2085    case CSSPropertyWebkitWrapShape:
     2086        if (id == CSSValueAuto)
     2087            validPrimitive = true;
     2088        else if (value->unit == CSSParserValue::Function)
     2089            return parseWrapShape(important);
     2090        break;
     2091#endif
    20792092
    20802093#if ENABLE(SVG)
     
    36503663}
    36513664
     3665#if ENABLE(CSS_EXCLUSIONS)
     3666PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeRect(CSSParserValueList* args)
     3667{
     3668    ASSERT(args);
     3669   
     3670    // rect(x, y, width, height, [[rx], ry])
     3671    if (args->size() != 7 && args->size() != 9 && args->size() != 11)
     3672        return 0;
     3673       
     3674    bool valid = true;
     3675   
     3676    RefPtr<CSSWrapShapeRect> shape = CSSWrapShapeRect::create();
     3677   
     3678    unsigned argumentNumber = 0;
     3679    CSSParserValue* argument = args->current();
     3680    while (argument) {
     3681        valid = validUnit(argument, FLength, m_strict);
     3682        if (!valid)
     3683            break;
     3684       
     3685        RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
     3686            (CSSPrimitiveValue::UnitTypes) argument->unit);
     3687        ASSERT(argumentNumber < 6);
     3688        switch (argumentNumber) {
     3689        case 0:
     3690            shape->setLeft(length);
     3691            break;
     3692        case 1:
     3693            shape->setTop(length);
     3694            break;
     3695        case 2:
     3696            shape->setWidth(length);
     3697            break;
     3698        case 3:
     3699            shape->setHeight(length);
     3700            break;
     3701        case 4:
     3702            shape->setRadiusX(length);
     3703            break;
     3704        case 5:
     3705            shape->setRadiusY(length);
     3706            break;
     3707        }
     3708        argument = args->next();
     3709        if (argument) {
     3710            if (argument->unit == CSSParserValue::Operator && argument->iValue == ',')
     3711                argument = args->next();
     3712            else {
     3713                valid = false;
     3714                break;
     3715            }
     3716        }
     3717        argumentNumber++;
     3718    }
     3719   
     3720    if (!valid || argumentNumber < 4)
     3721        return 0;   
     3722    return shape;
     3723}
     3724
     3725PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeCircle(CSSParserValueList* args)
     3726{
     3727    ASSERT(args);
     3728   
     3729    // circle(x, y, r)
     3730    if (args->size() != 5)
     3731        return 0;
     3732       
     3733    bool valid = true;
     3734   
     3735    RefPtr<CSSWrapShapeCircle> shape = CSSWrapShapeCircle::create();
     3736   
     3737    unsigned argumentNumber = 0;
     3738    CSSParserValue* argument = args->current();
     3739    while (argument) {
     3740        valid = validUnit(argument, FLength, m_strict);
     3741        if (!valid)
     3742            break;
     3743
     3744        RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
     3745            (CSSPrimitiveValue::UnitTypes) argument->unit);
     3746        ASSERT(argumentNumber < 3);
     3747        switch (argumentNumber) {
     3748        case 0:
     3749            shape->setLeft(length);
     3750            break;
     3751        case 1:
     3752            shape->setTop(length);
     3753            break;
     3754        case 2:
     3755            shape->setRadius(length);
     3756            break;
     3757        }
     3758       
     3759        argument = args->next();
     3760        if (argument) {
     3761            if (argument->unit == CSSParserValue::Operator && argument->iValue == ',')
     3762                argument = args->next();
     3763            else {
     3764                valid = false;
     3765                break;
     3766            }
     3767        }
     3768        argumentNumber++;
     3769    }
     3770   
     3771    if (!valid || argumentNumber < 3)
     3772        return 0;   
     3773    return shape;
     3774}
     3775
     3776PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapeEllipse(CSSParserValueList* args)
     3777{
     3778    ASSERT(args);
     3779   
     3780    // ellipse(x, y, rx, ry)
     3781    if (args->size() != 7)
     3782        return 0;
     3783       
     3784    bool valid = false;
     3785   
     3786    RefPtr<CSSWrapShapeEllipse> shape = CSSWrapShapeEllipse::create();
     3787    unsigned argumentNumber = 0;
     3788    CSSParserValue* argument = args->current();
     3789    while (argument) {
     3790        valid = validUnit(argument, FLength, m_strict);
     3791        if (!valid)
     3792            break;
     3793       
     3794        RefPtr<CSSPrimitiveValue> length = primitiveValueCache()->createValue(argument->fValue,
     3795            (CSSPrimitiveValue::UnitTypes) argument->unit);
     3796        ASSERT(argumentNumber < 4);
     3797        switch (argumentNumber) {
     3798        case 0:
     3799            shape->setLeft(length);
     3800            break;
     3801        case 1:
     3802            shape->setTop(length);
     3803            break;
     3804        case 2:
     3805            shape->setRadiusX(length);
     3806            break;
     3807        case 3:
     3808            shape->setRadiusY(length);
     3809            break;
     3810        }
     3811       
     3812        argument = args->next();
     3813        if (argument) {
     3814            if (argument && argument->unit == CSSParserValue::Operator && argument->iValue == ',')
     3815                argument = args->next();
     3816            else {
     3817                valid = false;
     3818                break;
     3819            }
     3820        }
     3821        argumentNumber++;
     3822    }
     3823   
     3824    if (!valid || argumentNumber < 4)
     3825        return 0;
     3826    return shape;
     3827}
     3828
     3829PassRefPtr<CSSWrapShape> CSSParser::parseWrapShapePolygon(CSSParserValueList* args)
     3830{
     3831    ASSERT(args);
     3832
     3833    unsigned size = args->size();
     3834    if (!size)
     3835        return 0;
     3836   
     3837    RefPtr<CSSWrapShapePolygon> shape = CSSWrapShapePolygon::create();
     3838
     3839    CSSParserValue* argument = args->current();
     3840    if (argument->id == CSSValueEvenodd || argument->id == CSSValueNonzero) {
     3841        shape->setWindRule(argument->id == CSSValueEvenodd ? RULE_EVENODD : RULE_NONZERO);
     3842
     3843        CSSParserValue* comma = args->next();
     3844        if (!comma || comma->unit != CSSParserValue::Operator || comma->iValue != ',')
     3845            return 0;
     3846
     3847        argument = args->next();
     3848        size -= 2;
     3849    }
     3850   
     3851    // <length>, <length> ... <length>, <length> -> each pair has 3 elements
     3852    if (!size || (size % 3))
     3853        return 0;
     3854   
     3855    CSSParserValue* argumentX = argument;
     3856    while (argumentX) {
     3857        if (!validUnit(argumentX, FLength, m_strict))
     3858            return 0;
     3859       
     3860        CSSParserValue* comma = args->next();
     3861        if (!comma || comma->unit != CSSParserValue::Operator || comma->iValue != ',')
     3862            return 0;
     3863       
     3864        CSSParserValue* argumentY = args->next();
     3865        if (!argumentY || !validUnit(argumentY, FLength, m_strict))
     3866            return 0;
     3867       
     3868        RefPtr<CSSPrimitiveValue> xLength = primitiveValueCache()->createValue(argumentX->fValue,
     3869            (CSSPrimitiveValue::UnitTypes) argumentX->unit);
     3870        RefPtr<CSSPrimitiveValue> yLength = primitiveValueCache()->createValue(argumentY->fValue,
     3871            (CSSPrimitiveValue::UnitTypes) argumentY->unit);
     3872       
     3873        shape->appendPoint(xLength.release(), yLength.release());
     3874       
     3875        argumentX = args->next();
     3876    }
     3877   
     3878    return shape;
     3879}
     3880
     3881bool CSSParser::parseWrapShape(bool important)
     3882{
     3883    CSSParserValue* value = m_valueList->current();
     3884    CSSParserValueList* args = value->function->args.get();
     3885
     3886    if (!args)
     3887        return false;
     3888   
     3889    RefPtr<CSSWrapShape> shape;
     3890   
     3891    if (equalIgnoringCase(value->function->name, "rect("))
     3892        shape = parseWrapShapeRect(args);
     3893    else if (equalIgnoringCase(value->function->name, "circle("))
     3894        shape = parseWrapShapeCircle(args);
     3895    else if (equalIgnoringCase(value->function->name, "ellipse("))
     3896        shape = parseWrapShapeEllipse(args);
     3897    else if (equalIgnoringCase(value->function->name, "polygon("))
     3898        shape = parseWrapShapePolygon(args);
     3899
     3900    if (shape) {
     3901        addProperty(CSSPropertyWebkitWrapShape, primitiveValueCache()->createValue(shape.release()), important);
     3902        m_valueList->next();
     3903        return true;
     3904    }
     3905
     3906    return false;
     3907}
     3908#endif // ENABLE(CSS_EXCLUSIONS)
     3909
    36523910// [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family'
    36533911bool CSSParser::parseFont(bool important)
  • trunk/Source/WebCore/css/CSSParser.h

    r90642 r90863  
    5454    class WebKitCSSKeyframesRule;
    5555
     56#if ENABLE(CSS_EXCLUSIONS)
     57    class CSSWrapShape;
     58#endif
     59
    5660    class CSSParser {
    5761    public:
     
    125129
    126130        bool parseShape(int propId, bool important);
     131
     132#if ENABLE(CSS_EXCLUSIONS)
     133        bool parseWrapShape(bool important);
     134        PassRefPtr<CSSWrapShape> parseWrapShapeRect(CSSParserValueList* args);
     135        PassRefPtr<CSSWrapShape> parseWrapShapeCircle(CSSParserValueList* args);
     136        PassRefPtr<CSSWrapShape> parseWrapShapeEllipse(CSSParserValueList* args);
     137        PassRefPtr<CSSWrapShape> parseWrapShapePolygon(CSSParserValueList* args);
     138#endif
    127139
    128140        bool parseFont(bool important);
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r90642 r90863  
    4242#if ENABLE(DASHBOARD_SUPPORT)
    4343#include "DashboardRegion.h"
     44#endif
     45
     46#if ENABLE(CSS_EXCLUSIONS)
     47#include "CSSWrapShapes.h"
    4448#endif
    4549
     
    211215}
    212216
     217#if ENABLE(CSS_EXCLUSIONS)
     218void CSSPrimitiveValue::init(PassRefPtr<CSSWrapShape> shape)
     219{
     220    m_type = CSS_SHAPE;
     221    m_hasCachedCSSText = false;
     222    m_value.shape = shape.releaseRef();
     223}
     224#endif
     225
    213226CSSPrimitiveValue::~CSSPrimitiveValue()
    214227{
     
    242255            if (m_value.region)
    243256                m_value.region->deref();
     257            break;
     258#endif
     259#if ENABLE(CSS_EXCLUSIONS)
     260        case CSS_SHAPE:
     261            m_value.shape->deref();
    244262            break;
    245263#endif
     
    827845            text = quoteCSSStringIfNeeded(m_value.string);
    828846            break;
     847#if ENABLE(CSS_EXCLUSIONS)
     848        case CSS_SHAPE:
     849            text = m_value.shape->cssText();
     850            break;
     851#endif
    829852    }
    830853
  • trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r90642 r90863  
    3737class Rect;
    3838class RenderStyle;
     39
     40#if ENABLE(CSS_EXCLUSIONS)
     41class CSSWrapShape;
     42#endif
    3943
    4044struct Length;
     
    96100        // This is used internally for counter names (as opposed to counter values)
    97101        CSS_COUNTER_NAME = 109,
    98         CSS_FROM_FLOW = 110
     102        CSS_FROM_FLOW = 110,
     103
     104        // This is used by the CSS Exclusions draft
     105        CSS_SHAPE = 111
    99106    };
    100107   
     
    176183    DashboardRegion* getDashboardRegionValue() const { return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region; }
    177184
     185#if ENABLE(CSS_EXCLUSIONS)
     186    CSSWrapShape* getShapeValue() const { return m_type != CSS_SHAPE ? 0 : m_value.shape; }
     187#endif
     188
    178189    int getIdent() const;
    179190    template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
     
    215226    void init(PassRefPtr<Pair>);
    216227    void init(PassRefPtr<DashboardRegion>); // FIXME: Dashboard region should not be a primitive value.
     228#if ENABLE(CSS_EXCLUSIONS)
     229    void init(PassRefPtr<CSSWrapShape>);
     230#endif
    217231    bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
    218232
     
    234248        Pair* pair;
    235249        DashboardRegion* region;
     250#if ENABLE(CSS_EXCLUSIONS)
     251        CSSWrapShape* shape;
     252#endif
    236253    } m_value;
    237254};
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r90541 r90863  
    330330-webkit-flow
    331331#endif
     332#if defined(ENABLE_CSS_EXCLUSIONS) && ENABLE_CSS_EXCLUSIONS
     333-webkit-wrap-shape
     334#endif
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r90642 r90863  
    53335333        return;
    53345334    }
     5335   
     5336#if ENABLE(CSS_EXCLUSIONS)
     5337    case CSSPropertyWebkitWrapShape:
     5338        if (isInitial) {
     5339            HANDLE_INITIAL_COND(CSSPropertyWebkitWrapShape, WrapShape)
     5340            return;
     5341        }
     5342       
     5343        if (primitiveValue && primitiveValue->getIdent() == CSSValueAuto)
     5344            m_style->setWrapShape(0);
     5345       
     5346        if (primitiveValue && primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_SHAPE)
     5347            m_style->setWrapShape(primitiveValue->getShapeValue());
     5348
     5349        return;
     5350#endif
    53355351
    53365352    // These properties are implemented in the CSSStyleApplyProperty lookup table.
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r89864 r90863  
    811811optimizeQuality
    812812-webkit-optimize-contrast
     813
     814#if defined(ENABLE_CSS_EXCLUSIONS) && ENABLE_CSS_EXCLUSIONS
     815// -webkit-wrap-shape
     816nonzero
     817evenodd
     818#endif
  • trunk/Source/WebCore/css/SVGCSSValueKeywords.in

    r89362 r90863  
    163163// CSS_PROP_CLIP_PATH
    164164// CSS_PROP_CLIP_RULE
     165#if !defined(ENABLE_CSS_EXCLUSIONS) || !ENABLE_CSS_EXCLUSIONS
     166// CSS exclusions also uses nonzero and evenodd, so don't duplicate the values
     167// if ENABLED_CSS_EXCLUSIONS is enabled.
    165168nonzero
    166169evenodd
     170#endif
    167171
    168172// CSS_PROP_MASK
  • trunk/Source/WebCore/platform/graphics/Path.h

    r90832 r90863  
    3030
    3131#include "RoundedRect.h"
     32#include "WindRule.h"
    3233#include <wtf/FastAllocBase.h>
    3334#include <wtf/Forward.h>
     
    8182    class GraphicsContext;
    8283    class StrokeStyleApplier;
    83 
    84     enum WindRule {
    85         RULE_NONZERO = 0,
    86         RULE_EVENODD = 1
    87     };
    8884
    8985    enum PathElementType {
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r90832 r90863  
    3636#include <wtf/StdLibExtras.h>
    3737#include <algorithm>
     38
     39#if ENABLE(EXCLUSION)
     40#include "CSSWrapShapes.h"
     41#endif
    3842
    3943using namespace std;
     
    569573        || rareInheritedData->m_imageRendering != other->rareInheritedData->m_imageRendering)
    570574        return StyleDifferenceRepaint;
     575       
     576#if ENABLE(CSS_EXCLUSIONS)
     577        // FIXME: The current spec is being reworked to remove dependencies between exclusions and affected
     578        // content. There's a proposal to use floats instead. In that case, wrap-shape should actually relayout
     579        // the parent container. For sure, I will have to revisit this code, but for now I've added this in order
     580        // to avoid having diff() == StyleDifferenceEqual where wrap-shapes actually differ.
     581        // Tracking bug: https://bugs.webkit.org/show_bug.cgi?id=62991
     582        if (rareNonInheritedData->m_wrapShape != other->rareNonInheritedData->m_wrapShape)
     583            return StyleDifferenceRepaint;
     584#endif
    571585
    572586#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r90832 r90863  
    11501150    float floodOpacity() const { return svgStyle()->floodOpacity(); }
    11511151    void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
     1152#endif
     1153
     1154#if ENABLE(CSS_EXCLUSIONS)
     1155    void setWrapShape(PassRefPtr<CSSWrapShape> shape)
     1156    {
     1157        if (rareNonInheritedData->m_wrapShape != shape)
     1158            rareNonInheritedData.access()->m_wrapShape = shape;
     1159    }
     1160    CSSWrapShape* wrapShape() const { return rareNonInheritedData->m_wrapShape.get(); }
     1161    static CSSWrapShape* initialWrapShape() { return 0; }
    11521162#endif
    11531163
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r90642 r90863  
    5959    , m_flowThread(RenderStyle::initialFlowThread())
    6060    , m_regionThread(RenderStyle::initialRegionThread())
     61#endif
     62#if ENABLE(CSS_EXCLUSIONS)
     63    , m_wrapShape(RenderStyle::initialWrapShape())
    6164#endif
    6265{
     
    103106    , m_regionThread(o.m_regionThread)
    104107#endif
     108#if ENABLE(CSS_EXCLUSIONS)
     109    , m_wrapShape(o.m_wrapShape)
     110#endif
    105111{
    106112}
     
    153159        && (m_regionThread == o.m_regionThread)
    154160#endif
     161#if ENABLE(CSS_EXCLUSIONS)
     162        && (m_wrapShape == o.m_wrapShape)
     163#endif
    155164        ;
    156165}
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r90642 r90863  
    3636#include <wtf/PassRefPtr.h>
    3737#include <wtf/Vector.h>
     38
     39#if ENABLE(CSS_EXCLUSIONS)
     40#include "CSSWrapShapes.h"
     41#endif
    3842
    3943namespace WebCore {
     
    137141#endif
    138142
     143#if ENABLE(CSS_EXCLUSIONS)
     144    RefPtr<CSSWrapShape> m_wrapShape;
     145#endif
     146
    139147private:
    140148    StyleRareNonInheritedData();
Note: See TracChangeset for help on using the changeset viewer.