⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 139866 in webkit


Ignore:
Timestamp:
Jan 16, 2013, 3:30:50 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

Implement CSSSupportsRule
https://bugs.webkit.org/show_bug.cgi?id=104822

Patch by Pablo Flouret <pablof@motorola.com> on 2013-01-16
Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface

Right now, @supports is not implemented as a proper CSSRule. Apart from
the CSSOM implications it gives wrong results when, for instance, an
@supports rule is nested inside a @media rule.

Test: css3/supports-cssom.html

  • CMakeLists.txt:
  • DerivedSources.cpp:
  • DerivedSources.make:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.exp.in:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:

Add CSSSupportsRule.* and associated files.

  • bindings/js/JSCSSRuleCustom.cpp:

(WebCore::toJS):

  • bindings/objc/DOMCSS.mm:

(kitClass):

  • bindings/v8/custom/V8CSSRuleCustom.cpp:

(WebCore::wrap):

Create the correct wrappers for the rule.

  • css/CSSGrammar.y.in:
  • css/CSSParser.cpp:

(WebCore::CSSParser::createSupportsRule):
(WebCore::CSSParser::markSupportsRuleHeaderStart):
(WebCore::CSSParser::markSupportsRuleHeaderEnd):

  • css/CSSParser.h:

Create the supports rule when parsing and add it where it corresponds,
instead of directly adding the child rules to the stylesheet.

  • css/CSSPropertySourceData.h:
  • css/CSSRule.h:
  • css/CSSRule.idl:

Add SUPPORTS_RULE type to enums.

  • css/CSSSupportsRule.cpp: Added.

(WebCore::CSSSupportsRule::CSSSupportsRule):
(WebCore::CSSSupportsRule::~CSSSupportsRule):
(WebCore::CSSSupportsRule::cssText):
(WebCore::CSSSupportsRule::conditionText):

  • css/CSSSupportsRule.h: Added.

(WebCore::CSSSupportsRule::create):

  • css/CSSSupportsRule.idl: Added.

DOM interface.

  • css/RuleSet.cpp:

(WebCore::RuleSet::addChildRules):

Add rules included in the @supports rule.

  • css/StyleResolver.cpp:

(WebCore::collectCSSOMWrappers):

Collect CSSSupportsRule wrappers.

  • css/StyleRule.cpp:

(WebCore::StyleRuleBase::reportMemoryUsage):
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy):
(WebCore::StyleRuleBase::createCSSOMWrapper):
(WebCore::StyleRuleSupports::StyleRuleSupports):

  • css/StyleRule.h:

(StyleRuleBase):
(WebCore::StyleRuleBase::isSupportsRule):
(StyleRuleSupports):
(WebCore::StyleRuleSupports::create):
(WebCore::StyleRuleSupports::conditionText):
(WebCore::StyleRuleSupports::conditionIsSupported):
(WebCore::StyleRuleSupports::copy):
(WebCore::toStyleRuleSupports):

New subclass of StyleRuleBlock: StyleRuleSupports.

  • css/StyleSheetContents.cpp:

(WebCore::childRulesHaveFailedOrCanceledSubresources):

  • inspector/InspectorStyleSheet.cpp:

(flattenSourceData):
(WebCore::asCSSRuleList):

Handle @supports rules where needed.

LayoutTests:

  • css3/supports-cssom-expected.txt: Added.
  • css3/supports-cssom.html: Added.
  • css3/supports-expected.txt:
  • css3/supports.html:
  • platform/chromium/TestExpectations:
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
  • platform/wk2/TestExpectations:
Location:
trunk
Files:
5 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139865 r139866  
     12013-01-16  Pablo Flouret  <pablof@motorola.com>
     2
     3        Implement CSSSupportsRule
     4        https://bugs.webkit.org/show_bug.cgi?id=104822
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        * css3/supports-cssom-expected.txt: Added.
     9        * css3/supports-cssom.html: Added.
     10        * css3/supports-expected.txt:
     11        * css3/supports.html:
     12
     13        * platform/chromium/TestExpectations:
     14        * platform/efl/TestExpectations:
     15        * platform/gtk/TestExpectations:
     16        * platform/mac/TestExpectations:
     17        * platform/qt/TestExpectations:
     18        * platform/win/TestExpectations:
     19        * platform/wincairo/TestExpectations:
     20        * platform/wk2/TestExpectations:
     21
    1222013-01-16  Kent Tamura  <tkent@chromium.org>
    223
  • trunk/LayoutTests/css3/supports-expected.txt

    r131783 r139866  
    3939PASS getComputedStyle(document.getElementById('t33')).content is "APPLIED"
    4040PASS getComputedStyle(document.getElementById('t34')).content is "UNTOUCHED"
     41PASS getComputedStyle(document.getElementById('t35')).content is "APPLIED"
     42PASS getComputedStyle(document.getElementById('t36')).content is "UNTOUCHED"
    4143PASS successfullyParsed is true
    4244
  • trunk/LayoutTests/css3/supports.html

    r131783 r139866  
    8585    }
    8686
    87     /* Nesting. */
    88     @supports (display: none) {
    89         @supports (display: deadbeef) {
    90             #t18 { content: "FAIL" }
    91         }
    92         @supports (display: inline) {
    93             #t19 { content: "APPLIED" }
    94         }
    95         @supports (display: inline) {
    96         }
    97         @media all {
    98             #t20 { content: "APPLIED" }
    99             @supports (display: inline) {
    100                 #t21 { content: "APPLIED" }
    101             }
    102         }
    103     }
    104 
    10587    /* Whitespace/Syntax */
    10688    @supports not( display: deadbeef) {
     
    158140    }
    159141
     142    /* Nesting. */
     143    @supports (display: none) {
     144        @supports (display: deadbeef) {
     145            #t18 { content: "FAIL" }
     146        }
     147        @supports (display: inline) {
     148            #t19 { content: "APPLIED" }
     149        }
     150        @supports (display: inline) {
     151        }
     152        @media all {
     153            #t20 { content: "APPLIED" }
     154            @supports (display: inline) {
     155                #t21 { content: "APPLIED" }
     156            }
     157        }
     158    }
     159
     160    @media all {
     161        @supports (display: inline) {
     162            @media all {
     163                @supports (display: none) {
     164                    #t35 { content: "APPLIED" }
     165                }
     166            }
     167        }
     168    }
     169
     170    @media not all {
     171        @supports (display: none) {
     172            #t36 { content: "FAIL" }
     173        }
     174    }
    160175</style>
    161176</head>
     
    165180<script>
    166181    description("Test the @supports rule.");
    167     var numTests = 35;
    168     var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34]; // Tests whose content shouldn't change from the UNTOUCHED default.
     182    var numTests = 37;
     183    var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34, 36]; // Tests whose content shouldn't change from the UNTOUCHED default.
    169184
    170185    var container = document.getElementById("test_container");
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r139865 r139866  
    39283928# css3-conditionals support is not yet enabled.
    39293929webkit.org/b/86146 css3/supports.html
     3930webkit.org/b/104822 css3/supports-cssom.html
    39303931
    39313932# CSS Device Adaptation is not enabled.
  • trunk/LayoutTests/platform/efl/TestExpectations

    r139861 r139866  
    15591559# css3-conditionals support is not yet enabled.
    15601560webkit.org/b/86146 css3/supports.html
     1561webkit.org/b/104822 css3/supports-cssom.html
    15611562
    15621563# Occasionally fails if run after right after
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r139855 r139866  
    403403# css3-conditionals support is not yet enabled.
    404404webkit.org/b/86146 css3/supports.html
     405webkit.org/b/104822 css3/supports-cssom.html
    405406
    406407# Requires Resolution Media Query support
  • trunk/LayoutTests/platform/mac/TestExpectations

    r139846 r139866  
    11621162# css3-conditionals support is not yet enabled.
    11631163webkit.org/b/86146 css3/supports.html
     1164webkit.org/b/104822 css3/supports-cssom.html
    11641165
    11651166# CSS Device Adaptation is not enabled.
  • trunk/LayoutTests/platform/qt/TestExpectations

    r139846 r139866  
    23972397# css3-conditionals support is not yet enabled.
    23982398webkit.org/b/86146 css3/supports.html
     2399webkit.org/b/104822 css3/supports-cssom.html
    23992400
    24002401# CSS Device Adaptation is not enabled.
  • trunk/LayoutTests/platform/win/TestExpectations

    r139846 r139866  
    23892389css3/flexbox/flexbox-baseline-margins.html
    23902390
    2391 # css3-conditionals support is not yet enabled. http://webkit.org/b/86146
     2391# css3-conditionals support is not yet enabled. http://webkit.org/b/86146 http://webkit.org/b/104822
    23922392css3/supports.html
     2393css3/supports-cssom.html
    23932394
    23942395# https://bugs.webkit.org/show_bug.cgi?id=98169
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r139846 r139866  
    28942894css3/flexbox/flexbox-baseline-margins.html
    28952895
    2896 # css3-conditionals support is not yet enabled. http://webkit.org/b/86146
     2896# css3-conditionals support is not yet enabled. http://webkit.org/b/86146 http://webkit.org/b/104822
    28972897css3/supports.html
     2898css3/supports-cssom.html
    28982899
    28992900# https://bugs.webkit.org/show_bug.cgi?id=98169
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r139242 r139866  
    346346# css3-conditionals support is not yet enabled.
    347347webkit.org/b/86146 css3/supports.html
     348webkit.org/b/104822 css3/supports-cssom.html
    348349
    349350# Text Autosizing is not yet enabled.
  • trunk/Source/WebCore/CMakeLists.txt

    r139706 r139866  
    322322    css/CSSStyleRule.idl
    323323    css/CSSStyleSheet.idl
     324    css/CSSSupportsRule.idl
    324325    css/CSSValue.idl
    325326    css/CSSValueList.idl
     
    10561057    css/CSSStyleRule.cpp
    10571058    css/CSSStyleSheet.cpp
     1059    css/CSSSupportsRule.cpp
    10581060    css/CSSTimingFunctionValue.cpp
    10591061    css/CSSToStyleMap.cpp
  • trunk/Source/WebCore/ChangeLog

    r139865 r139866  
     12013-01-16  Pablo Flouret  <pablof@motorola.com>
     2
     3        Implement CSSSupportsRule
     4        https://bugs.webkit.org/show_bug.cgi?id=104822
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface
     9
     10        Right now, @supports is not implemented as a proper CSSRule. Apart from
     11        the CSSOM implications it gives wrong results when, for instance, an
     12        @supports rule is nested inside a @media rule.
     13
     14        Test: css3/supports-cssom.html
     15
     16        * CMakeLists.txt:
     17        * DerivedSources.cpp:
     18        * DerivedSources.make:
     19        * DerivedSources.pri:
     20        * GNUmakefile.list.am:
     21        * Target.pri:
     22        * WebCore.exp.in:
     23        * WebCore.gypi:
     24        * WebCore.vcproj/WebCore.vcproj:
     25        * WebCore.xcodeproj/project.pbxproj:
     26            Add CSSSupportsRule.* and associated files.
     27
     28        * bindings/js/JSCSSRuleCustom.cpp:
     29        (WebCore::toJS):
     30        * bindings/objc/DOMCSS.mm:
     31        (kitClass):
     32        * bindings/v8/custom/V8CSSRuleCustom.cpp:
     33        (WebCore::wrap):
     34            Create the correct wrappers for the rule.
     35
     36        * css/CSSGrammar.y.in:
     37        * css/CSSParser.cpp:
     38        (WebCore::CSSParser::createSupportsRule):
     39        (WebCore::CSSParser::markSupportsRuleHeaderStart):
     40        (WebCore::CSSParser::markSupportsRuleHeaderEnd):
     41        * css/CSSParser.h:
     42            Create the supports rule when parsing and add it where it corresponds,
     43            instead of directly adding the child rules to the stylesheet.
     44
     45        * css/CSSPropertySourceData.h:
     46        * css/CSSRule.h:
     47        * css/CSSRule.idl:
     48            Add SUPPORTS_RULE type to enums.
     49
     50        * css/CSSSupportsRule.cpp: Added.
     51        (WebCore::CSSSupportsRule::CSSSupportsRule):
     52        (WebCore::CSSSupportsRule::~CSSSupportsRule):
     53        (WebCore::CSSSupportsRule::cssText):
     54        (WebCore::CSSSupportsRule::conditionText):
     55        * css/CSSSupportsRule.h: Added.
     56        (WebCore::CSSSupportsRule::create):
     57        * css/CSSSupportsRule.idl: Added.
     58            DOM interface.
     59
     60        * css/RuleSet.cpp:
     61        (WebCore::RuleSet::addChildRules):
     62            Add rules included in the @supports rule.
     63
     64        * css/StyleResolver.cpp:
     65        (WebCore::collectCSSOMWrappers):
     66            Collect CSSSupportsRule wrappers.
     67
     68        * css/StyleRule.cpp:
     69        (WebCore::StyleRuleBase::reportMemoryUsage):
     70        (WebCore::StyleRuleBase::destroy):
     71        (WebCore::StyleRuleBase::copy):
     72        (WebCore::StyleRuleBase::createCSSOMWrapper):
     73        (WebCore::StyleRuleSupports::StyleRuleSupports):
     74        * css/StyleRule.h:
     75        (StyleRuleBase):
     76        (WebCore::StyleRuleBase::isSupportsRule):
     77        (StyleRuleSupports):
     78        (WebCore::StyleRuleSupports::create):
     79        (WebCore::StyleRuleSupports::conditionText):
     80        (WebCore::StyleRuleSupports::conditionIsSupported):
     81        (WebCore::StyleRuleSupports::copy):
     82        (WebCore::toStyleRuleSupports):
     83            New subclass of StyleRuleBlock: StyleRuleSupports.
     84
     85        * css/StyleSheetContents.cpp:
     86        (WebCore::childRulesHaveFailedOrCanceledSubresources):
     87        * inspector/InspectorStyleSheet.cpp:
     88        (flattenSourceData):
     89        (WebCore::asCSSRuleList):
     90            Handle @supports rules where needed.
     91
    1922013-01-16  Kent Tamura  <tkent@chromium.org>
    293
  • trunk/Source/WebCore/DerivedSources.cpp

    r137507 r139866  
    6565#include "JSCSSStyleRule.cpp"
    6666#include "JSCSSStyleSheet.cpp"
     67#include "JSCSSSupportsRule.cpp"
    6768#include "JSCSSValue.cpp"
    6869#include "JSCSSValueList.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r139331 r139866  
    179179    $(WebCore)/css/CSSStyleRule.idl \
    180180    $(WebCore)/css/CSSStyleSheet.idl \
     181    $(WebCore)/css/CSSSupportsRule.idl \
    181182    $(WebCore)/css/CSSUnknownRule.idl \
    182183    $(WebCore)/css/CSSValue.idl \
  • trunk/Source/WebCore/DerivedSources.pri

    r139331 r139866  
    199199    $$PWD/css/CSSStyleRule.idl \
    200200    $$PWD/css/CSSStyleSheet.idl \
     201    $$PWD/css/CSSSupportsRule.idl \
    201202    $$PWD/css/CSSValue.idl \
    202203    $$PWD/css/CSSValueList.idl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r139768 r139866  
    134134        DerivedSources/WebCore/JSCSSStyleSheet.cpp \
    135135        DerivedSources/WebCore/JSCSSStyleSheet.h \
     136        DerivedSources/WebCore/JSCSSSupportsRule.cpp \
     137        DerivedSources/WebCore/JSCSSSupportsRule.h \
    136138        DerivedSources/WebCore/JSCSSValue.cpp \
    137139        DerivedSources/WebCore/JSCSSValue.h \
     
    13301332        $(WebCore)/css/CSSStyleRule.idl \
    13311333        $(WebCore)/css/CSSStyleSheet.idl \
     1334        $(WebCore)/css/CSSSupportsRule.idl \
    13321335        $(WebCore)/css/CSSValue.idl \
    13331336        $(WebCore)/css/CSSValueList.idl \
     
    25932596        Source/WebCore/css/CSSStyleSheet.cpp \
    25942597        Source/WebCore/css/CSSStyleSheet.h \
     2598        Source/WebCore/css/CSSSupportsRule.cpp \
     2599        Source/WebCore/css/CSSSupportsRule.h \
    25952600        Source/WebCore/css/CSSTimingFunctionValue.cpp \
    25962601        Source/WebCore/css/CSSTimingFunctionValue.h \
  • trunk/Source/WebCore/Target.pri

    r139666 r139866  
    288288    css/CSSStyleRule.cpp \
    289289    css/CSSStyleSheet.cpp \
     290    css/CSSSupportsRule.cpp \
    290291    css/CSSTimingFunctionValue.cpp \
    291292    css/CSSToStyleMap.cpp \
     
    14991500    css/CSSStyleRule.h \
    15001501    css/CSSStyleSheet.h \
     1502    css/CSSSupportsRule.h \
    15011503    css/CSSTimingFunctionValue.h \
    15021504    css/CSSToStyleMap.h \
  • trunk/Source/WebCore/WebCore.exp.in

    r139796 r139866  
    15771577.objc_class_name_DOMCSSStyleRule
    15781578.objc_class_name_DOMCSSStyleSheet
     1579.objc_class_name_DOMCSSSupportsRule
    15791580.objc_class_name_DOMCSSUnknownRule
    15801581.objc_class_name_DOMCSSValue
  • trunk/Source/WebCore/WebCore.gypi

    r139860 r139866  
    170170            'css/CSSStyleRule.idl',
    171171            'css/CSSStyleSheet.idl',
     172            'css/CSSSupportsRule.idl',
    172173            'css/CSSUnknownRule.idl',
    173174            'css/CSSValue.idl',
     
    15061507            'css/CSSStyleSheet.cpp',
    15071508            'css/CSSStyleSheet.h',
     1509            'css/CSSSupportsRule.cpp',
     1510            'css/CSSSupportsRule.h',
    15081511            'css/CSSTimingFunctionValue.cpp',
    15091512            'css/CSSTimingFunctionValue.h',
     
    55855588            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSStyleSheet.mm',
    55865589            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSStyleSheetInternal.h',
     5590            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSSupportsRule.mm',
     5591            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSSupportsRuleInternal.h',
    55875592            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSUnknownRule.mm',
    55885593            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMCSSUnknownRuleInternal.h',
     
    61456150            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSStyleSheet.cpp',
    61466151            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSStyleSheet.h',
     6152            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSSupportsRule.cpp',
     6153            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSSupportsRule.h',
    61476154            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSUnknownRule.cpp',
    61486155            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSUnknownRule.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r139860 r139866  
    23632363                        </File>
    23642364                        <File
     2365                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSCSSSupportsRule.cpp"
     2366                                >
     2367                                <FileConfiguration
     2368                                        Name="Debug|Win32"
     2369                                        ExcludedFromBuild="true"
     2370                                        >
     2371                                        <Tool
     2372                                                Name="VCCLCompilerTool"
     2373                                        />
     2374                                </FileConfiguration>
     2375                                <FileConfiguration
     2376                                        Name="Release|Win32"
     2377                                        ExcludedFromBuild="true"
     2378                                        >
     2379                                        <Tool
     2380                                                Name="VCCLCompilerTool"
     2381                                        />
     2382                                </FileConfiguration>
     2383                                <FileConfiguration
     2384                                        Name="Debug_Cairo_CFLite|Win32"
     2385                                        ExcludedFromBuild="true"
     2386                                        >
     2387                                        <Tool
     2388                                                Name="VCCLCompilerTool"
     2389                                        />
     2390                                </FileConfiguration>
     2391                                <FileConfiguration
     2392                                        Name="Release_Cairo_CFLite|Win32"
     2393                                        ExcludedFromBuild="true"
     2394                                        >
     2395                                        <Tool
     2396                                                Name="VCCLCompilerTool"
     2397                                        />
     2398                                </FileConfiguration>
     2399                                <FileConfiguration
     2400                                        Name="Debug_All|Win32"
     2401                                        ExcludedFromBuild="true"
     2402                                        >
     2403                                        <Tool
     2404                                                Name="VCCLCompilerTool"
     2405                                        />
     2406                                </FileConfiguration>
     2407                                <FileConfiguration
     2408                                        Name="Production|Win32"
     2409                                        ExcludedFromBuild="true"
     2410                                        >
     2411                                        <Tool
     2412                                                Name="VCCLCompilerTool"
     2413                                        />
     2414                                </FileConfiguration>
     2415                        </File>
     2416                        <File
     2417                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSCSSSupportsRule.h"
     2418                                >
     2419                        </File>
     2420                        <File
    23652421                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSCSSValue.cpp"
    23662422                                >
     
    3736737423                        </File>
    3736837424                        <File
     37425                                RelativePath="..\css\CSSSupportsRule.cpp"
     37426                                >
     37427                                <FileConfiguration
     37428                                        Name="Debug|Win32"
     37429                                        ExcludedFromBuild="true"
     37430                                        >
     37431                                        <Tool
     37432                                                Name="VCCLCompilerTool"
     37433                                        />
     37434                                </FileConfiguration>
     37435                                <FileConfiguration
     37436                                        Name="Release|Win32"
     37437                                        ExcludedFromBuild="true"
     37438                                        >
     37439                                        <Tool
     37440                                                Name="VCCLCompilerTool"
     37441                                        />
     37442                                </FileConfiguration>
     37443                                <FileConfiguration
     37444                                        Name="Debug_Cairo_CFLite|Win32"
     37445                                        ExcludedFromBuild="true"
     37446                                        >
     37447                                        <Tool
     37448                                                Name="VCCLCompilerTool"
     37449                                        />
     37450                                </FileConfiguration>
     37451                                <FileConfiguration
     37452                                        Name="Release_Cairo_CFLite|Win32"
     37453                                        ExcludedFromBuild="true"
     37454                                        >
     37455                                        <Tool
     37456                                                Name="VCCLCompilerTool"
     37457                                        />
     37458                                </FileConfiguration>
     37459                                <FileConfiguration
     37460                                        Name="Debug_All|Win32"
     37461                                        ExcludedFromBuild="true"
     37462                                        >
     37463                                        <Tool
     37464                                                Name="VCCLCompilerTool"
     37465                                        />
     37466                                </FileConfiguration>
     37467                                <FileConfiguration
     37468                                        Name="Production|Win32"
     37469                                        ExcludedFromBuild="true"
     37470                                        >
     37471                                        <Tool
     37472                                                Name="VCCLCompilerTool"
     37473                                        />
     37474                                </FileConfiguration>
     37475                        </File>
     37476                        <File
     37477                                RelativePath="..\css\CSSSupportsRule.h"
     37478                                >
     37479                        </File>
     37480                        <File
    3736937481                                RelativePath="..\css\CSSTimingFunctionValue.cpp"
    3737037482                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r139666 r139866  
    64466446                FBD6AF8D15EF260A008B7110 /* BasicShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */; };
    64476447                FBF89045169E9F1F0052D86E /* CSSGroupingRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBF89044169E9F1F0052D86E /* CSSGroupingRule.cpp */; };
     6448                FC63BDB3167AABAC00F9380F /* CSSSupportsRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC63BDB0167AABAC00F9380F /* CSSSupportsRule.cpp */; };
     6449                FC63BDB4167AABAC00F9380F /* CSSSupportsRule.h in Sources */ = {isa = PBXBuildFile; fileRef = FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */; };
     6450                FC7E66E91680EF1F00283716 /* JSCSSSupportsRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC84802D167AB444008CD100 /* JSCSSSupportsRule.cpp */; };
     6451                FC7E66EA1680EF2200283716 /* JSCSSSupportsRule.h in Sources */ = {isa = PBXBuildFile; fileRef = FC84802E167AB444008CD100 /* JSCSSSupportsRule.h */; };
     6452                FCD8832A16A49F8200962227 /* DOMCSSSupportsRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */; };
     6453                FCD8832B16A49F8200962227 /* DOMCSSSupportsRule.mm in Sources */ = {isa = PBXBuildFile; fileRef = FCD8832916A49F8200962227 /* DOMCSSSupportsRule.mm */; };
     6454                FCD8832C16A49FB000962227 /* DOMCSSSupportsRule.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */; };
     6455                FCEBBAAB16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = FCEBBAAA16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h */; };
    64486456                FD00D7A414A3F61900734011 /* SincResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD00D7A214A3F61900734011 /* SincResampler.cpp */; };
    64496457                FD00D7A514A3F61900734011 /* SincResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = FD00D7A314A3F61900734011 /* SincResampler.h */; };
     
    67756783                                85F74E090AA8DF8C000DC284 /* DOMCSSStyleRule.h in Copy Generated Headers */,
    67766784                                858C39BD0AA905EF00B187A4 /* DOMCSSStyleSheet.h in Copy Generated Headers */,
     6785                                FCD8832C16A49FB000962227 /* DOMCSSSupportsRule.h in Copy Generated Headers */,
    67776786                                85F74E0A0AA8DF8C000DC284 /* DOMCSSUnknownRule.h in Copy Generated Headers */,
    67786787                                858C39B80AA905EF00B187A4 /* DOMCSSValue.h in Copy Generated Headers */,
     
    1402514034                FBD6AF8715EF21D4008B7110 /* CSSBasicShapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSBasicShapes.h; sourceTree = "<group>"; };
    1402614035                FBF89044169E9F1F0052D86E /* CSSGroupingRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGroupingRule.cpp; sourceTree = "<group>"; };
     14036                FC63BDB0167AABAC00F9380F /* CSSSupportsRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSSupportsRule.cpp; sourceTree = "<group>"; };
     14037                FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSupportsRule.h; sourceTree = "<group>"; };
     14038                FC63BDB2167AABAC00F9380F /* CSSSupportsRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSSupportsRule.idl; sourceTree = "<group>"; };
     14039                FC84802D167AB444008CD100 /* JSCSSSupportsRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSSupportsRule.cpp; sourceTree = "<group>"; };
     14040                FC84802E167AB444008CD100 /* JSCSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSSupportsRule.h; sourceTree = "<group>"; };
     14041                FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMCSSSupportsRule.h; path = DOMCSSSupportsRule.h; sourceTree = "<group>"; };
     14042                FCD8832916A49F8200962227 /* DOMCSSSupportsRule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DOMCSSSupportsRule.mm; path = DOMCSSSupportsRule.mm; sourceTree = "<group>"; };
     14043                FCEBBAAA16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMCSSSupportsRuleInternal.h; path = DOMCSSSupportsRuleInternal.h; sourceTree = "<group>"; };
    1402714044                FCEBCD711623A7910029965E /* CSSGrammar.y.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; path = CSSGrammar.y.in; sourceTree = "<group>"; };
    1402814045                FCEBCD721623A7910029965E /* CSSGrammar.y.includes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; path = CSSGrammar.y.includes; sourceTree = "<group>"; };
     
    1642416441                                858C39260AA8FF9D00B187A4 /* DOMCSSStyleSheet.h */,
    1642516442                                858C39270AA8FF9D00B187A4 /* DOMCSSStyleSheet.mm */,
     16443                                FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */,
     16444                                FCD8832916A49F8200962227 /* DOMCSSSupportsRule.mm */,
    1642616445                                85032DD50AA8C9BE007D3B7D /* DOMCSSUnknownRule.h */,
    1642716446                                85032DD60AA8C9BE007D3B7D /* DOMCSSUnknownRule.mm */,
     
    1712317142                                85909CD90ACC7A7E00DF01F1 /* DOMCSSStyleRuleInternal.h */,
    1712417143                                85909CDA0ACC7A7E00DF01F1 /* DOMCSSStyleSheetInternal.h */,
     17144                                FCEBBAAA16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h */,
    1712517145                                85909CDB0ACC7A7E00DF01F1 /* DOMCSSUnknownRuleInternal.h */,
    1712617146                                85B498F20ADB336A00925CBB /* DOMCSSValueInternal.h */,
     
    1924219262                                BCC5BDFE0C0E93110011C2DB /* JSCSSStyleSheet.cpp */,
    1924319263                                BCC5BDFF0C0E93110011C2DB /* JSCSSStyleSheet.h */,
     19264                                FC84802D167AB444008CD100 /* JSCSSSupportsRule.cpp */,
     19265                                FC84802E167AB444008CD100 /* JSCSSSupportsRule.h */,
    1924419266                                14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */,
    1924519267                                14CF78A509F58CD800EB3665 /* JSCSSValue.h */,
     
    2159721619                                A8EA7FFF0A19516E00A8EF5F /* CSSStyleSheet.h */,
    2159821620                                858C39100AA8FF0000B187A4 /* CSSStyleSheet.idl */,
     21621                                FC63BDB0167AABAC00F9380F /* CSSSupportsRule.cpp */,
     21622                                FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */,
     21623                                FC63BDB2167AABAC00F9380F /* CSSSupportsRule.idl */,
    2159921624                                BC80C9850CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp */,
    2160021625                                BC80C9860CD294EE00A0B7B3 /* CSSTimingFunctionValue.h */,
     
    2321923244                                858C39280AA8FF9D00B187A4 /* DOMCSSStyleSheet.h in Headers */,
    2322023245                                85909CE30ACC7A7E00DF01F1 /* DOMCSSStyleSheetInternal.h in Headers */,
     23246                                FCD8832A16A49F8200962227 /* DOMCSSSupportsRule.h in Headers */,
     23247                                FCEBBAAB16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h in Headers */,
    2322123248                                85032DE90AA8C9BE007D3B7D /* DOMCSSUnknownRule.h in Headers */,
    2322223249                                85909CE40ACC7A7E00DF01F1 /* DOMCSSUnknownRuleInternal.h in Headers */,
     
    2668826715                                A80E6CEF0A1989CA007FB8C5 /* CSSStyleRule.cpp in Sources */,
    2668926716                                A8EA80080A19516E00A8EF5F /* CSSStyleSheet.cpp in Sources */,
     26717                                FC63BDB3167AABAC00F9380F /* CSSSupportsRule.cpp in Sources */,
     26718                                FC63BDB4167AABAC00F9380F /* CSSSupportsRule.h in Sources */,
    2669026719                                BC80C9870CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp in Sources */,
    2669126720                                A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */,
     
    2680826837                                85032DE80AA8C9BE007D3B7D /* DOMCSSStyleRule.mm in Sources */,
    2680926838                                858C39290AA8FF9D00B187A4 /* DOMCSSStyleSheet.mm in Sources */,
     26839                                FCD8832B16A49F8200962227 /* DOMCSSSupportsRule.mm in Sources */,
    2681026840                                85032DEA0AA8C9BE007D3B7D /* DOMCSSUnknownRule.mm in Sources */,
    2681126841                                858C381D0AA8E29600B187A4 /* DOMCSSValue.mm in Sources */,
     
    2762427654                                E1AD14E81297377400ACA989 /* JSCSSStyleRuleCustom.cpp in Sources */,
    2762527655                                BCC5BE000C0E93110011C2DB /* JSCSSStyleSheet.cpp in Sources */,
     27656                                FC7E66E91680EF1F00283716 /* JSCSSSupportsRule.cpp in Sources */,
     27657                                FC7E66EA1680EF2200283716 /* JSCSSSupportsRule.h in Sources */,
    2762627658                                14CF78A409F58CBF00EB3665 /* JSCSSValue.cpp in Sources */,
    2762727659                                BC20FB7F0C0E8E6C00D1447F /* JSCSSValueCustom.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp

    r135564 r139866  
    3333#include "CSSPageRule.h"
    3434#include "CSSStyleRule.h"
     35#include "CSSSupportsRule.h"
    3536#include "JSCSSCharsetRule.h"
    3637#include "JSCSSFontFaceRule.h"
     
    3940#include "JSCSSPageRule.h"
    4041#include "JSCSSStyleRule.h"
     42#include "JSCSSSupportsRule.h"
    4143#include "JSNode.h"
    4244#include "JSWebKitCSSKeyframeRule.h"
     
    9799            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframesRule, rule);
    98100            break;
     101#if ENABLE(CSS3_CONDITIONAL_RULES)
     102        case CSSRule::SUPPORTS_RULE:
     103            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CSSSupportsRule, rule);
     104            break;
     105#endif
    99106#if ENABLE(CSS_DEVICE_ADAPTATION)
    100107        case CSSRule::WEBKIT_VIEWPORT_RULE:
  • trunk/Source/WebCore/bindings/objc/DOMCSS.mm

    r135564 r139866  
    4141#import "DOMCSSStyleRule.h"
    4242#import "DOMCSSStyleSheet.h"
     43#if ENABLE(CSS3_CONDITIONAL_RULES)
     44#import "DOMCSSSupportsRule.h"
     45#endif
    4346#import "DOMCSSUnknownRule.h"
    4447#import "DOMCSSValueInternal.h"
     
    100103        case DOM_WEBKIT_KEYFRAME_RULE:
    101104            return [DOMWebKitCSSKeyframeRule class];
     105#if ENABLE(CSS3_CONDITIONAL_RULES)
     106        case DOM_SUPPORTS_RULE:
     107            return [DOMCSSSupportsRule class];
     108#endif
    102109#if ENABLE(CSS_DEVICE_ADAPTATION)
    103110        case DOM_WEBKIT_VIEWPORT_RULE:
  • trunk/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp

    r135564 r139866  
    3838#include "V8CSSPageRule.h"
    3939#include "V8CSSStyleRule.h"
     40#if ENABLE(CSS3_CONDITIONAL_RULES)
     41#include "V8CSSSupportsRule.h"
     42#endif
    4043#include "V8WebKitCSSKeyframeRule.h"
    4144#include "V8WebKitCSSKeyframesRule.h"
     
    7376    case CSSRule::WEBKIT_KEYFRAMES_RULE:
    7477        return wrap(static_cast<WebKitCSSKeyframesRule*>(impl), creationContext, isolate);
     78#if ENABLE(CSS3_CONDITIONAL_RULES)
     79    case CSSRule::SUPPORTS_RULE:
     80        return wrap(static_cast<CSSSupportsRule*>(impl), creationContext, isolate);
     81#endif
    7582#if ENABLE(CSS_DEVICE_ADAPTATION)
    7683    case CSSRule::WEBKIT_VIEWPORT_RULE:
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r139594 r139866  
    465465  | media
    466466  | keyframes
     467#if ENABLE_CSS3_CONDITIONAL_RULES
     468  | supports
     469#endif
    467470#if ENABLE_CSS_DEVICE_ADAPTATION
    468471  | viewport
     
    477480  | import
    478481  | region
    479 #if ENABLE_CSS3_CONDITIONAL_RULES
    480   | supports
    481 #endif
    482482  ;
    483483
     
    677677#if ENABLE_CSS3_CONDITIONAL_RULES
    678678supports:
    679     SUPPORTS_SYM maybe_space supports_condition '{' maybe_space block_rule_list save_block {
    680         CSSParser* p = static_cast<CSSParser*>(parser);
    681         if ($3 && $6 && p->m_styleSheet) {
    682             for (unsigned i = 0; i < $6->size(); i++)
    683                 p->m_styleSheet->parserAppendRule($6->at(i).release());
    684         }
    685         $$ = 0;
     679    before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports_rule_header_end '{' at_rule_body_start maybe_space block_rule_list save_block {
     680        $$ = parser->createSupportsRule($4, $9);
     681    }
     682    ;
     683
     684before_supports_rule:
     685    /* empty */ {
     686        parser->markRuleHeaderStart(CSSRuleSourceData::SUPPORTS_RULE);
     687        parser->markSupportsRuleHeaderStart();
     688    }
     689    ;
     690
     691at_supports_rule_header_end:
     692    /* empty */ {
     693        parser->markRuleHeaderEnd();
     694        parser->markSupportsRuleHeaderEnd();
    686695    }
    687696    ;
  • trunk/Source/WebCore/css/CSSParser.cpp

    r139836 r139866  
    1070410704}
    1070510705
     10706#if ENABLE(CSS3_CONDITIONAL_RULES)
     10707StyleRuleBase* CSSParser::createSupportsRule(bool conditionIsSupported, RuleList* rules)
     10708{
     10709    m_allowImportRules = m_allowNamespaceDeclarations = false;
     10710
     10711    ASSERT(!m_supportsRuleDataStack->isEmpty());
     10712    RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last();
     10713    m_supportsRuleDataStack->removeLast();
     10714    if (m_supportsRuleDataStack->isEmpty())
     10715        m_supportsRuleDataStack.clear();
     10716
     10717    RefPtr<StyleRuleSupports> rule;
     10718    String conditionText;
     10719    unsigned conditionOffset = data->ruleHeaderRange.start + 9;
     10720    unsigned conditionLength = data->ruleHeaderRange.length() - 9;
     10721
     10722    if (is8BitSource())
     10723        conditionText = String(m_dataStart8.get() + conditionOffset, conditionLength).stripWhiteSpace();
     10724    else
     10725        conditionText = String(m_dataStart16.get() + conditionOffset, conditionLength).stripWhiteSpace();
     10726
     10727    if (rules)
     10728        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, *rules);
     10729    else {
     10730        RuleList emptyRules;
     10731        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, emptyRules);
     10732    }
     10733
     10734    StyleRuleSupports* result = rule.get();
     10735    m_parsedRules.append(rule.release());
     10736    processAndAddNewRuleToSourceTreeIfNeeded();
     10737
     10738    return result;
     10739}
     10740
     10741void CSSParser::markSupportsRuleHeaderStart()
     10742{
     10743    if (!m_supportsRuleDataStack)
     10744        m_supportsRuleDataStack = adoptPtr(new RuleSourceDataList());
     10745
     10746    RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(CSSRuleSourceData::SUPPORTS_RULE);
     10747    data->ruleHeaderRange.start = tokenStartOffset();
     10748    m_supportsRuleDataStack->append(data);
     10749}
     10750
     10751void CSSParser::markSupportsRuleHeaderEnd()
     10752{
     10753    ASSERT(!m_supportsRuleDataStack->isEmpty());
     10754
     10755    if (is8BitSource())
     10756        m_supportsRuleDataStack->last()->ruleHeaderRange.end = tokenStart<LChar>() - m_dataStart8.get();
     10757    else
     10758        m_supportsRuleDataStack->last()->ruleHeaderRange.end = tokenStart<UChar>() - m_dataStart16.get();
     10759}
     10760#endif
     10761
    1070610762CSSParser::RuleList* CSSParser::createRuleList()
    1070710763{
  • trunk/Source/WebCore/css/CSSParser.h

    r139836 r139866  
    293293    StyleRuleBase* createRegionRule(Vector<OwnPtr<CSSParserSelector> >* regionSelector, RuleList* rules);
    294294    StyleRuleBase* createMarginAtRule(CSSSelector::MarginBoxType);
     295#if ENABLE(CSS3_CONDITIONAL_RULES)
     296    StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*);
     297    void markSupportsRuleHeaderStart();
     298    void markSupportsRuleHeaderEnd();
     299#endif
    295300#if ENABLE(SHADOW_DOM)
    296301    StyleRuleBase* createHostRule(RuleList* rules);
     
    567572    RefPtr<CSSCalcValue> m_parsedCalculation;
    568573
     574#if ENABLE(CSS3_CONDITIONAL_RULES)
     575    OwnPtr<RuleSourceDataList> m_supportsRuleDataStack;
     576#endif
     577
    569578    // defines units allowed for a certain property, used in parseUnit
    570579    enum Units {
  • trunk/Source/WebCore/css/CSSPropertySourceData.h

    r136370 r139866  
    9898        REGION_RULE,
    9999        HOST_RULE,
    100         VIEWPORT_RULE
     100        VIEWPORT_RULE,
     101        SUPPORTS_RULE
    101102    };
    102103
  • trunk/Source/WebCore/css/CSSRule.h

    r135465 r139866  
    5151        WEBKIT_KEYFRAMES_RULE,
    5252        WEBKIT_KEYFRAME_RULE,
     53#if ENABLE(CSS3_CONDITIONAL_RULES)
     54        SUPPORTS_RULE = 12,
     55#endif
    5356#if ENABLE(CSS_DEVICE_ADAPTATION)
    5457        WEBKIT_VIEWPORT_RULE = 15,
  • trunk/Source/WebCore/css/CSSRule.idl

    r135564 r139866  
    3838    const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
    3939    const unsigned short WEBKIT_KEYFRAME_RULE = 8;
     40#if defined(ENABLE_CSS3_CONDITIONAL_RULES) && ENABLE_CSS3_CONDITIONAL_RULES
     41    const unsigned short SUPPORTS_RULE = 12;
     42#endif
    4043#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION
    4144    const unsigned short WEBKIT_VIEWPORT_RULE = 15;
  • trunk/Source/WebCore/css/RuleSet.cpp

    r139594 r139866  
    321321        }
    322322#endif
     323#if ENABLE(CSS3_CONDITIONAL_RULES)
     324        else if (rule->isSupportsRule() && static_cast<StyleRuleSupports*>(rule)->conditionIsSupported())
     325            addChildRules(static_cast<StyleRuleSupports*>(rule)->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
     326#endif
    323327    }
    324328}
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r139824 r139866  
    4949#include "CSSStyleRule.h"
    5050#include "CSSStyleSheet.h"
     51#include "CSSSupportsRule.h"
    5152#include "CSSTimingFunctionValue.h"
    5253#include "CSSValueList.h"
     
    26392640            collectCSSOMWrappers(wrapperMap, static_cast<CSSMediaRule*>(cssRule));
    26402641            break;
     2642#if ENABLE(CSS3_CONDITIONAL_RULES)
     2643        case CSSRule::SUPPORTS_RULE:
     2644            collectCSSOMWrappers(wrapperMap, static_cast<CSSSupportsRule*>(cssRule));
     2645            break;
     2646#endif
    26412647#if ENABLE(CSS_REGIONS)
    26422648        case CSSRule::WEBKIT_REGION_RULE:
  • trunk/Source/WebCore/css/StyleRule.cpp

    r137417 r139866  
    2929#include "CSSPageRule.h"
    3030#include "CSSStyleRule.h"
     31#include "CSSSupportsRule.h"
    3132#include "CSSUnknownRule.h"
    3233#include "StyleRuleImport.h"
     
    8283        static_cast<const StyleRuleKeyframes*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
    8384        return;
     85#if ENABLE(CSS3_CONDITIONAL_RULES)
     86    case Supports:
     87#endif
    8488#if ENABLE(SHADOW_DOM)
    8589    case Host:
     
    119123        delete static_cast<StyleRuleMedia*>(this);
    120124        return;
     125#if ENABLE(CSS3_CONDITIONAL_RULES)
     126    case Supports:
     127        delete static_cast<StyleRuleSupports*>(this);
     128        return;
     129#endif
    121130#if ENABLE(CSS_REGIONS)
    122131    case Region:
     
    163172    case Media:
    164173        return static_cast<const StyleRuleMedia*>(this)->copy();
     174#if ENABLE(CSS3_CONDITIONAL_RULES)
     175    case Supports:
     176        return static_cast<const StyleRuleSupports*>(this)->copy();
     177#endif
    165178#if ENABLE(CSS_REGIONS)
    166179    case Region:
     
    211224        rule = CSSMediaRule::create(static_cast<StyleRuleMedia*>(self), parentSheet);
    212225        break;
     226#if ENABLE(CSS3_CONDITIONAL_RULES)
     227    case Supports:
     228        rule = CSSSupportsRule::create(static_cast<StyleRuleSupports*>(self), parentSheet);
     229        break;
     230#endif
    213231#if ENABLE(CSS_REGIONS)
    214232    case Region:
     
    405423}
    406424
     425
     426#if ENABLE(CSS3_CONDITIONAL_RULES)
     427StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules)
     428    : StyleRuleBlock(Supports, adoptRules)
     429    , m_conditionText(conditionText)
     430    , m_conditionIsSupported(conditionIsSupported)
     431{
     432}
     433
     434StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o)
     435    : StyleRuleBlock(o)
     436    , m_conditionText(o.m_conditionText)
     437    , m_conditionIsSupported(o.m_conditionIsSupported)
     438{
     439}
     440#endif
     441
    407442StyleRuleRegion::StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
    408443    : StyleRuleBlock(Region, adoptRules)
  • trunk/Source/WebCore/css/StyleRule.h

    r139409 r139866  
    5050        Host,
    5151#endif
     52#if ENABLE(CSS3_CONDITIONAL_RULES)
     53        Supports = 12,
     54#endif
    5255#if ENABLE(CSS_DEVICE_ADAPTATION)
    5356        Viewport = 15,
     
    6467    bool isStyleRule() const { return type() == Style; }
    6568    bool isRegionRule() const { return type() == Region; }
     69#if ENABLE(CSS3_CONDITIONAL_RULES)
     70    bool isSupportsRule() const { return type() == Supports; }
     71#endif
    6672#if ENABLE(CSS_DEVICE_ADAPTATION)
    6773    bool isViewportRule() const { return type() == Viewport; }
     
    215221    RefPtr<MediaQuerySet> m_mediaQueries;
    216222};
     223
     224#if ENABLE(CSS3_CONDITIONAL_RULES)
     225class StyleRuleSupports : public StyleRuleBlock {
     226public:
     227    static PassRefPtr<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules)
     228    {
     229        return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
     230    }
     231
     232    String conditionText() const { return m_conditionText; }
     233    bool conditionIsSupported() const { return m_conditionIsSupported; }
     234    PassRefPtr<StyleRuleSupports> copy() const { return adoptRef(new StyleRuleSupports(*this)); }
     235
     236private:
     237    StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules);
     238    StyleRuleSupports(const StyleRuleSupports&);
     239
     240    String m_conditionText;
     241    bool m_conditionIsSupported;
     242};
     243#endif
    217244
    218245class StyleRuleRegion : public StyleRuleBlock {
     
    282309}
    283310
     311#if ENABLE(CSS3_CONDITIONAL_RULES)
     312inline const StyleRuleSupports* toStyleRuleSupports(const StyleRuleBlock* rule)
     313{
     314    ASSERT(!rule || rule->isSupportsRule());
     315    return static_cast<const StyleRuleSupports*>(rule);
     316}
     317#endif
     318
    284319inline const StyleRuleRegion* toStyleRuleRegion(const StyleRuleBlock* rule)
    285320{
  • trunk/Source/WebCore/css/StyleSheetContents.cpp

    r139589 r139866  
    457457        case StyleRuleBase::Charset:
    458458        case StyleRuleBase::Keyframe:
     459#if ENABLE(CSS3_CONDITIONAL_RULES)
     460        case StyleRuleBase::Supports:
     461#endif
    459462#if ENABLE(CSS_DEVICE_ADAPTATION)
    460463        case StyleRuleBase::Viewport:
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r138460 r139866  
    3838#include "CSSStyleRule.h"
    3939#include "CSSStyleSheet.h"
     40#include "CSSSupportsRule.h"
    4041#include "ContentSecurityPolicy.h"
    4142#include "Document.h"
     
    110111        else if (data->type == CSSRuleSourceData::MEDIA_RULE)
    111112            flattenSourceData(&data->childRules, target);
     113#if ENABLE(CSS3_CONDITIONAL_RULES)
     114        else if (data->type == CSSRuleSourceData::SUPPORTS_RULE)
     115            flattenSourceData(&data->childRules, target);
     116#endif
    112117    }
    113118}
     
    209214    if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE)
    210215        return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
     216
     217#if ENABLE(CSS3_CONDITIONAL_RULES)
     218    if (rule->type() == CSSRule::SUPPORTS_RULE)
     219        return static_cast<CSSSupportsRule*>(rule)->cssRules();
     220#endif
    211221
    212222    return 0;
Note: See TracChangeset for help on using the changeset viewer.