Added viewport at-rule to the CSS parser and tokenizer
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 22:22:07 +0000 (22:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2012 22:22:07 +0000 (22:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95961

Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-10-31
Reviewed by Kenneth Rohde Christiansen.

.:

Enable CSS Device Adaptation by default on EFL.

* Source/cmake/OptionsEfl.cmake:

Source/WebCore:

Add tokens and grammar rules to parse @-webkit-viewport blocks. Also add
the newly parsed rule to the rule list.

This parser now implements the following part of the CSS Device Adaptation
specification: http://www.w3.org/TR/css-device-adapt/#syntax

Test: css3/device-adapt/viewport-at-rule-parsing.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::detectAtToken):
(WebCore):
(WebCore::CSSParser::createViewportRule):
* css/CSSParser.h:
(CSSParser):
(WebCore::CSSParser::markViewportRuleBodyStart):
(WebCore::CSSParser::markViewportRuleBodyEnd):
(WebCore::CSSParser::inViewport):

    These methods are needed by the next patch validating the properties.
    Some viewport properties are common to other rules but have different
    semantics, and accepts different keywords. The validation needs to be
    done in a different code path.

* css/CSSPropertySourceData.h:
* css/CSSRule.cpp:
(WebCore):
(WebCore::CSSRule::cssText):
(WebCore::CSSRule::destroy):
(WebCore::CSSRule::reattach):
(WebCore::CSSRule::reportMemoryUsage):
* css/CSSRule.h:
(CSSRule):
(WebCore::CSSRule::isViewportRule):
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::reportMemoryUsage):
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy):
(WebCore::StyleRuleBase::createCSSOMWrapper):
(WebCore):
(WebCore::StyleRuleViewport::StyleRuleViewport):
(WebCore::StyleRuleViewport::~StyleRuleViewport):
(WebCore::StyleRuleViewport::mutableProperties):
(WebCore::StyleRuleViewport::setProperties):
(WebCore::StyleRuleViewport::reportDescendantMemoryUsage):
* css/StyleRule.h:
(StyleRuleBase):
(WebCore::StyleRuleBase::isViewportRule):
(WebCore):
(StyleRuleViewport):
(WebCore::StyleRuleViewport::create):
(WebCore::StyleRuleViewport::properties):
(WebCore::StyleRuleViewport::copy):
* css/WebKitCSSViewportRule.cpp: Added.
(WebCore):
(WebCore::WebKitCSSViewportRule::WebKitCSSViewportRule):
(WebCore::WebKitCSSViewportRule::~WebKitCSSViewportRule):
(WebCore::WebKitCSSViewportRule::style):
(WebCore::WebKitCSSViewportRule::cssText):
(WebCore::WebKitCSSViewportRule::reattach):
(WebCore::WebKitCSSViewportRule::reportDescendantMemoryUsage):
* css/WebKitCSSViewportRule.h: Added.
(WebCore):

Tools:

Enable CSS Device Adaptation by default on EFL.

* Scripts/webkitperl/FeatureList.pm:

LayoutTests:

Added a test that detects if the @-webkit-viewport rule is being
parsed and skip the tests on all ports since the feature is disabled
by default for instance.

Note that this test doesn't do property validation, which will be
added in the next patch of the series.

* css3/device-adapt/viewport-at-rule-parsing-expected.txt: Added.
* css3/device-adapt/viewport-at-rule-parsing.html: Added.
* platform/chromium/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:

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

30 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/css3/device-adapt/viewport-at-rule-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/device-adapt/viewport-at-rule-parsing.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Source/WebCore/CMakeLists.txt
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/CSSGrammar.y.in
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertySourceData.h
Source/WebCore/css/CSSRule.cpp
Source/WebCore/css/CSSRule.h
Source/WebCore/css/StyleRule.cpp
Source/WebCore/css/StyleRule.h
Source/WebCore/css/WebKitCSSViewportRule.cpp [new file with mode: 0644]
Source/WebCore/css/WebKitCSSViewportRule.h [new file with mode: 0644]
Source/cmake/OptionsEfl.cmake
Tools/ChangeLog
Tools/Scripts/webkitperl/FeatureList.pm

index 8880ec7..4583c21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Added viewport at-rule to the CSS parser and tokenizer
+        https://bugs.webkit.org/show_bug.cgi?id=95961
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Enable CSS Device Adaptation by default on EFL.
+
+        * Source/cmake/OptionsEfl.cmake:
+
 2012-10-31  Ian Vollick  <vollick@chromium.org>
 
         Add support for text-based repaint testing
index 7607a4a..7dc9b77 100644 (file)
@@ -1,3 +1,26 @@
+2012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Added viewport at-rule to the CSS parser and tokenizer
+        https://bugs.webkit.org/show_bug.cgi?id=95961
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added a test that detects if the @-webkit-viewport rule is being
+        parsed and skip the tests on all ports since the feature is disabled
+        by default for instance.
+
+        Note that this test doesn't do property validation, which will be
+        added in the next patch of the series.
+
+        * css3/device-adapt/viewport-at-rule-parsing-expected.txt: Added.
+        * css3/device-adapt/viewport-at-rule-parsing.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/qt/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+
 2012-10-31  Max Vujovic  <mvujovic@adobe.com>
 
         [CSS Shaders] Validate types of built-in uniforms
diff --git a/LayoutTests/css3/device-adapt/viewport-at-rule-parsing-expected.txt b/LayoutTests/css3/device-adapt/viewport-at-rule-parsing-expected.txt
new file mode 100644 (file)
index 0000000..9ceb1b4
--- /dev/null
@@ -0,0 +1,10 @@
+
+PASS Empty at-rule parsing 
+PASS at-rule with extra spaces 
+PASS Rule with attributes 
+PASS Rule with malformed attributes 
+PASS Should be accepted inside media queries 
+PASS Nested viewport rule 
+PASS Rules inside a viewport rule 
+PASS Should ignore unprefixed at-rule 
+
diff --git a/LayoutTests/css3/device-adapt/viewport-at-rule-parsing.html b/LayoutTests/css3/device-adapt/viewport-at-rule-parsing.html
new file mode 100644 (file)
index 0000000..99b3de7
--- /dev/null
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style type="text/css">
+        /* Valid viewport syntax. */
+        @-webkit-viewport {
+        }
+
+        /* Valid viewport syntax, extras spaces should be ignored. */
+        @-webkit-viewport          {
+        }
+
+        /* Valid viewport syntax, regular attributes. */
+        @-webkit-viewport {
+            max-height: 200px;
+            min-height: 200px;
+        }
+
+        /* Valid viewport syntax, should omit the malformed attribute. */
+        @-webkit-viewport {
+            asdasd
+        }
+
+        /* Valid viewport syntax, it is allowed inside media queries. */
+        @media all {
+            @-webkit-viewport {
+            }
+        }
+
+        /* Nested viewport rules are not allowed. The inner rule should be ignored. */
+        @-webkit-viewport {
+            max-height: 100px;
+            min-height: 100px;
+
+            @-webkit-viewport {
+                max-height: 200px;
+                min-height: 200px;
+            }
+        }
+
+        /* Rules inside a viewport should be ignored. */
+        @-webkit-viewport {
+            max-height: 50px;
+            min-height: 50px;
+
+            @import url('../../resources/testharness.css');
+        }
+
+        /* Should ignore unprefixed viewport rule. We need to change this
+           test if at some point we remove the prefix. */
+        @viewport {
+        }
+    </style>
+    <meta charset="utf-8" />
+    <link rel="help" href="http://www.w3.org/TR/css-device-adapt/#syntax" />
+    <script src="../../resources/testharness.js"></script>
+    <script src="../../resources/testharnessreport.js"></script>
+    <script type="text/javascript">
+        var rules = document.styleSheets[0].cssRules;
+
+        test(function() {
+            assert_equals(rules.item(0).cssText, "@-webkit-viewport { }");
+        }, "Empty at-rule parsing");
+
+        test(function() {
+            assert_equals(rules.item(1).cssText, "@-webkit-viewport { }");
+        }, "at-rule with extra spaces");
+
+        test(function() {
+            assert_equals(rules.item(2).cssText, "@-webkit-viewport { max-height: 200px; min-height: 200px; }");
+        }, "Rule with attributes");
+
+        test(function() {
+            assert_equals(rules.item(3).cssText, "@-webkit-viewport { }");
+        }, "Rule with malformed attributes");
+
+        test(function() {
+            assert_equals(rules.item(4).cssText, "@media all { \n  @-webkit-viewport { }\n}");
+        }, "Should be accepted inside media queries");
+
+        test(function() {
+            assert_equals(rules.item(5).cssText, "@-webkit-viewport { max-height: 100px; min-height: 100px; }");
+        }, "Nested viewport rule");
+
+        test(function() {
+            assert_equals(rules.item(6).cssText, "@-webkit-viewport { max-height: 50px; min-height: 50px; }");
+        }, "Rules inside a viewport rule");
+
+        // The total number of parsed rules should be 6, meaning that the parser
+        // ignored the last two rules.
+        test(function() {
+            assert_equals(rules.length, 7)
+        }, "Should ignore unprefixed at-rule");
+    </script>
+</head>
+<body>
+    <div id="log"></div>
+</body>
+</html>
index edd71e7..6a37863 100644 (file)
@@ -4027,6 +4027,9 @@ webkit.org/b/95121 fast/borders/border-image-side-reduction.html [ ImageOnlyFail
 # css3-conditionals support is not yet enabled.
 webkit.org/b/86146 css3/supports.html
 
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95959 css3/device-adapt [ Skip ]
+
 # Require rebaselining after webkit.org/b/97800
 webkit.org/b/89167 media/track/track-cue-rendering-horizontal.html [ Failure ]
 webkit.org/b/89167 media/track/track-cue-rendering-vertical.html [ Failure ]
index 84007bf..a6ef984 100644 (file)
@@ -1436,3 +1436,6 @@ webkit.org/b/95299 fast/images/exif-orientation.html [ Failure ]
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Tests failing
 #////////////////////////////////////////////////////////////////////////////////////////
+
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95959 css3/device-adapt [ Skip ]
index 4f51c06..3961f87 100644 (file)
@@ -1316,6 +1316,9 @@ webkit.org/b/99921 mathml/presentation/subsup.xhtml [ Failure ]
 # css3-conditionals support is not yet enabled.
 webkit.org/b/86146 css3/supports.html
 
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95959 css3/device-adapt [ Skip ]
+
 # Hardware accelerated CSS transitions appear pixelated when scaled up using transform
 webkit.org/b/27684 compositing/text-on-scaled-layer.html [ ImageOnlyFailure ]
 webkit.org/b/27684 compositing/text-on-scaled-surface.html [ ImageOnlyFailure ]
index 8cd4bf2..0dbfc42 100644 (file)
@@ -2475,6 +2475,9 @@ webkit.org/b/23166 ietestcenter/css3/bordersbackgrounds/border-radius-clip-002.h
 # css3-conditionals support is not yet enabled.
 webkit.org/b/86146 css3/supports.html
 
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95969 css3/device-adapt [ Skip ]
+
 # Added by bug 89826
 webkit.org/b/94005 css2.1/20110323/word-spacing-remove-space-003.htm [ ImageOnlyFailure ]
 webkit.org/b/94005 css2.1/20110323/word-spacing-remove-space-006.htm [ ImageOnlyFailure ]
index 29042c4..ebf05de 100644 (file)
@@ -880,6 +880,9 @@ http/tests/local/blob/send-sliced-data-blob.html
 # BlodBuilder is not enabled
 http/tests/local/blob/send-data-blob.html
 
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95959 css3/device-adapt [ Skip ]
+
 # <https://bugs.webkit.org/show_bug.cgi?id=29289>
 plugins/destroy-during-npp-new.html
 
index 2f62679..41d84ac 100644 (file)
@@ -2808,6 +2808,9 @@ http/tests/security/xssAuditor/xss-filter-bypass-long-string.html
 http/tests/xmlhttprequest/access-control-allow-lists-starting-with-comma.html
 http/tests/xmlhttprequest/range-test.html
 
+# CSS Device Adaptation is not enabled.
+webkit.org/b/95959 css3/device-adapt [ Skip ]
+
 # css3-conditionals support is not yet enabled.
 webkit.org/b/86146 css3/supports.html
 
index 9ec8e3d..5134465 100644 (file)
@@ -1103,6 +1103,7 @@ SET(WebCore_SOURCES
     css/WebKitCSSSVGDocumentValue.cpp
     css/WebKitCSSShaderValue.cpp
     css/WebKitCSSTransformValue.cpp
+    css/WebKitCSSViewportRule.cpp
 
     dom/ActiveDOMObject.cpp
     dom/Attr.cpp
index 2e7f17a..1b39cf2 100644 (file)
@@ -1,3 +1,81 @@
+2012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Added viewport at-rule to the CSS parser and tokenizer
+        https://bugs.webkit.org/show_bug.cgi?id=95961
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add tokens and grammar rules to parse @-webkit-viewport blocks. Also add
+        the newly parsed rule to the rule list.
+
+        This parser now implements the following part of the CSS Device Adaptation
+        specification: http://www.w3.org/TR/css-device-adapt/#syntax
+
+        Test: css3/device-adapt/viewport-at-rule-parsing.html
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSGrammar.y.in:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::CSSParser):
+        (WebCore::CSSParser::detectAtToken):
+        (WebCore):
+        (WebCore::CSSParser::createViewportRule):
+        * css/CSSParser.h:
+        (CSSParser):
+        (WebCore::CSSParser::markViewportRuleBodyStart):
+        (WebCore::CSSParser::markViewportRuleBodyEnd):
+        (WebCore::CSSParser::inViewport):
+
+            These methods are needed by the next patch validating the properties.
+            Some viewport properties are common to other rules but have different
+            semantics, and accepts different keywords. The validation needs to be
+            done in a different code path.
+
+        * css/CSSPropertySourceData.h:
+        * css/CSSRule.cpp:
+        (WebCore):
+        (WebCore::CSSRule::cssText):
+        (WebCore::CSSRule::destroy):
+        (WebCore::CSSRule::reattach):
+        (WebCore::CSSRule::reportMemoryUsage):
+        * css/CSSRule.h:
+        (CSSRule):
+        (WebCore::CSSRule::isViewportRule):
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::reportMemoryUsage):
+        (WebCore::StyleRuleBase::destroy):
+        (WebCore::StyleRuleBase::copy):
+        (WebCore::StyleRuleBase::createCSSOMWrapper):
+        (WebCore):
+        (WebCore::StyleRuleViewport::StyleRuleViewport):
+        (WebCore::StyleRuleViewport::~StyleRuleViewport):
+        (WebCore::StyleRuleViewport::mutableProperties):
+        (WebCore::StyleRuleViewport::setProperties):
+        (WebCore::StyleRuleViewport::reportDescendantMemoryUsage):
+        * css/StyleRule.h:
+        (StyleRuleBase):
+        (WebCore::StyleRuleBase::isViewportRule):
+        (WebCore):
+        (StyleRuleViewport):
+        (WebCore::StyleRuleViewport::create):
+        (WebCore::StyleRuleViewport::properties):
+        (WebCore::StyleRuleViewport::copy):
+        * css/WebKitCSSViewportRule.cpp: Added.
+        (WebCore):
+        (WebCore::WebKitCSSViewportRule::WebKitCSSViewportRule):
+        (WebCore::WebKitCSSViewportRule::~WebKitCSSViewportRule):
+        (WebCore::WebKitCSSViewportRule::style):
+        (WebCore::WebKitCSSViewportRule::cssText):
+        (WebCore::WebKitCSSViewportRule::reattach):
+        (WebCore::WebKitCSSViewportRule::reportDescendantMemoryUsage):
+        * css/WebKitCSSViewportRule.h: Added.
+        (WebCore):
+
 2012-10-31  Max Vujovic  <mvujovic@adobe.com>
 
         [CSS Shaders] Validate types of built-in uniforms
index c8ff699..afd3bd5 100644 (file)
@@ -2689,6 +2689,8 @@ webcore_sources += \
        Source/WebCore/css/WebKitCSSShaderValue.h \
        Source/WebCore/css/WebKitCSSTransformValue.cpp \
        Source/WebCore/css/WebKitCSSTransformValue.h \
+       Source/WebCore/css/WebKitCSSViewportRule.cpp \
+       Source/WebCore/css/WebKitCSSViewportRule.h \
        Source/WebCore/dom/ActiveDOMObject.cpp \
        Source/WebCore/dom/ActiveDOMObject.h \
        Source/WebCore/dom/Attr.cpp \
index c500941..54d50d7 100644 (file)
@@ -339,6 +339,7 @@ SOURCES += \
     css/WebKitCSSSVGDocumentValue.cpp \
     css/WebKitCSSShaderValue.cpp \
     css/WebKitCSSTransformValue.cpp \
+    css/WebKitCSSViewportRule.cpp \
     dom/ActiveDOMObject.cpp \
     dom/Attr.cpp \
     dom/BeforeTextInsertedEvent.cpp \
@@ -1512,6 +1513,7 @@ HEADERS += \
     css/WebKitCSSSVGDocumentValue.h \
     css/WebKitCSSShaderValue.h \
     css/WebKitCSSTransformValue.h \
+    css/WebKitCSSViewportRule.h \
     dom/ActiveDOMObject.h \
     dom/Attr.h \
     dom/Attribute.h \
index b335b96..9b2859f 100644 (file)
             'css/WebKitCSSSVGDocumentValue.cpp',
             'css/WebKitCSSSVGDocumentValue.h',
             'css/WebKitCSSTransformValue.cpp',
+            'css/WebKitCSSViewportRule.h',
+            'css/WebKitCSSViewportRule.cpp',
             'editing/AlternativeTextController.cpp',
             'editing/AlternativeTextController.h',
             'editing/AppendNodeCommand.cpp',
index 1c78c6a..0a6ee00 100755 (executable)
                            >
                        </File>
                        <File
+                               RelativePath="..\css\WebKitCSSViewportRule.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\css\WebKitCSSViewportRule.h"
+                               >
+                       </File>
+                       <File
                            RelativePath="..\css\BasicShapeFunctions.h"
                            >
                        </File>
index 82eb6ab..1891bc4 100644 (file)
                3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AC648B1129E146500C3EB25 /* EditingBoundary.h */; settings = {ATTRIBUTES = (Private, ); }; };
                3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
                3C244FEBA375AC633F88BE6F /* RenderLayerModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */; };
+               3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; };
+               3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */; };
                41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */; };
                41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */; };
                410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
                3AC648B1129E146500C3EB25 /* EditingBoundary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBoundary.h; sourceTree = "<group>"; };
                3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerModelObject.h; sourceTree = "<group>"; };
                3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerModelObject.cpp; sourceTree = "<group>"; };
+               3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSViewportRule.cpp; sourceTree = "<group>"; };
+               3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSViewportRule.h; sourceTree = "<group>"; };
                41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
                41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
                410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
                                BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */,
                                BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */,
                                31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */,
+                               3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
+                               3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
                        );
                        path = css;
                        sourceTree = "<group>";
                                AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */,
                                50933350163B0E4300099A60 /* CustomFilterParameterList.h in Headers */,
                                50D32858163B313F0016111E /* ValidatedCustomFilterOperation.h in Headers */,
+                               3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                5093334F163B0E4300099A60 /* CustomFilterParameterList.cpp in Sources */,
                                1AA21250163F0DA80000E63F /* AtomicStringCF.cpp in Sources */,
                                50D32857163B313F0016111E /* ValidatedCustomFilterOperation.cpp in Sources */,
+                               3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 4045113..22957c6 100644 (file)
@@ -3,6 +3,7 @@
  *  Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *  Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
  *  Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *  Copyright (C) 2012 Intel Corporation. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -109,6 +110,7 @@ static inline int cssyyerror(void*, const char*)
 %token WEBKIT_MEDIAQUERY_SYM
 %token WEBKIT_SELECTOR_SYM
 %token WEBKIT_REGION_RULE_SYM
+%token WEBKIT_VIEWPORT_RULE_SYM
 %token <marginBox> TOPLEFTCORNER_SYM
 %token <marginBox> TOPLEFT_SYM
 %token <marginBox> TOPCENTER_SYM
@@ -206,6 +208,9 @@ static inline int cssyyerror(void*, const char*)
 #if ENABLE_CSS3_CONDITIONAL_RULES
 %type <rule> supports
 #endif
+#if ENABLE_CSS_DEVICE_ADAPTATION
+%type <rule> viewport
+#endif
 
 %type <string> maybe_ns_prefix
 
@@ -411,6 +416,9 @@ valid_rule:
 #if ENABLE_SHADOW_DOM
   | host
 #endif
+#if ENABLE_CSS_DEVICE_ADAPTATION
+  | viewport
+#endif
   ;
 
 rule:
@@ -439,6 +447,9 @@ block_valid_rule:
   | page
   | font_face
   | keyframes
+#if ENABLE_CSS_DEVICE_ADAPTATION
+  | viewport
+#endif
   ;
 
 block_rule:
@@ -929,6 +940,33 @@ host:
     ;
 #endif
 
+#if ENABLE_CSS_DEVICE_ADAPTATION
+before_viewport_rule:
+    /* empty */ {
+        parser->markViewportRuleBodyStart();
+        parser->markRuleHeaderStart(CSSRuleSourceData::VIEWPORT_RULE);
+    }
+    ;
+
+viewport:
+    before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM at_rule_header_end_maybe_space
+    '{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
+        $$ = parser->createViewportRule();
+        parser->markViewportRuleBodyEnd();
+    }
+    | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error invalid_block {
+        $$ = 0;
+        parser->popRuleData();
+        parser->markViewportRuleBodyEnd();
+    }
+    | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error ';' {
+        $$ = 0;
+        parser->popRuleData();
+        parser->markViewportRuleBodyEnd();
+    }
+;
+#endif
+
 region_selector:
     selector_list {
         if ($1) {
index 91395a2..deb3e2c 100644 (file)
@@ -269,6 +269,9 @@ CSSParser::CSSParser(const CSSParserContext& context)
     , m_lastSelectorLineNumber(0)
     , m_allowImportRules(true)
     , m_allowNamespaceDeclarations(true)
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    , m_inViewport(false)
+#endif
     , m_selectorVector(adoptPtr(new CSSSelectorVector))
 {
 #if YYDEBUG > 0
@@ -9318,8 +9321,15 @@ inline void CSSParser::detectAtToken(int length, bool hasEscape)
             return;
 
         case 17:
-            if (!hasEscape && isEqualToCSSIdentifier(name + 2, "webkit-selector"))
+            if (hasEscape)
+                return;
+
+            if (isASCIIAlphaCaselessEqual(name[16], 'r') && isEqualToCSSIdentifier(name + 2, "webkit-selecto"))
                 m_token = WEBKIT_SELECTOR_SYM;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+            else if (isASCIIAlphaCaselessEqual(name[16], 't') && isEqualToCSSIdentifier(name + 2, "webkit-viewpor"))
+                m_token = WEBKIT_VIEWPORT_RULE_SYM;
+#endif
             return;
 
         case 18:
@@ -10392,6 +10402,24 @@ void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
     resetPropertyRange();
 }
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+StyleRuleBase* CSSParser::createViewportRule()
+{
+    m_allowImportRules = m_allowNamespaceDeclarations = false;
+
+    RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create();
+
+    rule->setProperties(createStylePropertySet());
+    clearProperties();
+
+    StyleRuleViewport* result = rule.get();
+    m_parsedRules.append(rule.release());
+    processAndAddNewRuleToSourceTreeIfNeeded();
+
+    return result;
+}
+#endif
+
 template <typename CharacterType>
 static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned length)
 {
index b62d88f..193e0b7 100644 (file)
@@ -366,6 +366,12 @@ public:
 
     int token() { return m_token; }
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    void markViewportRuleBodyStart() { m_inViewport = true; }
+    void markViewportRuleBodyEnd() { m_inViewport = false; }
+    StyleRuleBase* createViewportRule();
+#endif
+
     PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
     PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
 #if ENABLE(CSS_VARIABLES)
@@ -513,6 +519,11 @@ private:
     bool m_allowImportRules;
     bool m_allowNamespaceDeclarations;
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    bool inViewport() const { return m_inViewport; }
+    bool m_inViewport;
+#endif
+
     int (CSSParser::*m_lexFunc)(void*);
 
     Vector<RefPtr<StyleRuleBase> > m_parsedRules;
index 079ec33..8982acf 100644 (file)
@@ -95,7 +95,8 @@ struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> {
         PAGE_RULE,
         KEYFRAMES_RULE,
         REGION_RULE,
-        HOST_RULE
+        HOST_RULE,
+        VIEWPORT_RULE
     };
 
     static PassRefPtr<CSSRuleSourceData> create(Type type)
index cd533d9..6c522bd 100644 (file)
 #include "CSSStyleRule.h"
 #include "CSSStyleSheet.h"
 #include "CSSUnknownRule.h"
-#include "WebKitCSSKeyframeRule.h"
-#include "WebKitCSSKeyframesRule.h"
-#include "WebKitCSSRegionRule.h"
 #include "NotImplemented.h"
 #include "StyleRule.h"
 #include "StyleSheetContents.h"
+#include "WebKitCSSKeyframeRule.h"
+#include "WebKitCSSKeyframesRule.h"
+#include "WebKitCSSRegionRule.h"
+#include "WebKitCSSViewportRule.h"
 
 namespace WebCore {
 
@@ -50,6 +51,10 @@ COMPILE_ASSERT(sizeof(CSSRule) == sizeof(SameSizeAsCSSRule), CSSRule_should_stay
 COMPILE_ASSERT(StyleRuleBase::Region == static_cast<StyleRuleBase::Type>(CSSRule::WEBKIT_REGION_RULE), enums_should_match);
 #endif
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+COMPILE_ASSERT(StyleRuleBase::Viewport == static_cast<StyleRuleBase::Type>(CSSRule::WEBKIT_VIEWPORT_RULE), enums_should_match);
+#endif
+
 void CSSRule::setCssText(const String& /*cssText*/, ExceptionCode& /*ec*/)
 {
     notImplemented();
@@ -76,6 +81,10 @@ String CSSRule::cssText() const
         return static_cast<const WebKitCSSKeyframesRule*>(this)->cssText();
     case WEBKIT_KEYFRAME_RULE:
         return static_cast<const WebKitCSSKeyframeRule*>(this)->cssText();
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case WEBKIT_VIEWPORT_RULE:
+        return static_cast<const WebKitCSSViewportRule*>(this)->cssText();
+#endif
 #if ENABLE(CSS_REGIONS)
     case WEBKIT_REGION_RULE:
         return static_cast<const WebKitCSSRegionRule*>(this)->cssText();
@@ -115,6 +124,11 @@ void CSSRule::destroy()
     case WEBKIT_KEYFRAME_RULE:
         delete static_cast<WebKitCSSKeyframeRule*>(this);
         return;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case WEBKIT_VIEWPORT_RULE:
+        delete static_cast<WebKitCSSViewportRule*>(this);
+        return;
+#endif
 #if ENABLE(CSS_REGIONS)
     case WEBKIT_REGION_RULE:
         delete static_cast<WebKitCSSRegionRule*>(this);
@@ -155,6 +169,11 @@ void CSSRule::reattach(StyleRuleBase* rule)
         // No need to reattach, the underlying data is shareable on mutation.
         ASSERT_NOT_REACHED();
         return;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case WEBKIT_VIEWPORT_RULE:
+        static_cast<WebKitCSSViewportRule*>(this)->reattach(static_cast<StyleRuleViewport*>(rule));
+        return;
+#endif
 #if ENABLE(CSS_REGIONS)
     case WEBKIT_REGION_RULE:
         static_cast<WebKitCSSRegionRule*>(this)->reattach(static_cast<StyleRuleRegion*>(rule));
@@ -194,6 +213,11 @@ void CSSRule::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     case WEBKIT_KEYFRAME_RULE:
         static_cast<const WebKitCSSKeyframeRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case WEBKIT_VIEWPORT_RULE:
+        static_cast<const WebKitCSSViewportRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
 #if ENABLE(CSS_REGIONS)
     case WEBKIT_REGION_RULE:
         static_cast<const WebKitCSSRegionRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
index b31fe7b..ab30048 100644 (file)
@@ -57,6 +57,9 @@ public:
         // <https://bugs.webkit.org/show_bug.cgi?id=71293>.
         WEBKIT_KEYFRAMES_RULE,
         WEBKIT_KEYFRAME_RULE,
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+        WEBKIT_VIEWPORT_RULE = 15,
+#endif
 #if ENABLE(CSS_REGIONS)
         WEBKIT_REGION_RULE = 16
 #endif
@@ -73,6 +76,10 @@ public:
     bool isStyleRule() const { return type() == STYLE_RULE; }
     bool isImportRule() const { return type() == IMPORT_RULE; }
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    bool isViewportRule() const { return type() == WEBKIT_VIEWPORT_RULE; }
+#endif
+
 #if ENABLE(CSS_REGIONS)
     bool isRegionRule() const { return type() == WEBKIT_REGION_RULE; }
 #endif
index 67f7bc7..713c971 100644 (file)
@@ -33,6 +33,7 @@
 #include "WebKitCSSKeyframeRule.h"
 #include "WebKitCSSKeyframesRule.h"
 #include "WebKitCSSRegionRule.h"
+#include "WebKitCSSViewportRule.h"
 #include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
@@ -82,6 +83,11 @@ void StyleRuleBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     case Host:
         static_cast<const StyleRuleBlock*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case Viewport:
+        static_cast<const StyleRuleViewport*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
+        return;
+#endif
     case Unknown:
     case Charset:
     case Keyframe:
@@ -123,6 +129,11 @@ void StyleRuleBase::destroy()
     case Host:
         delete static_cast<StyleRuleHost*>(this);
         return;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case Viewport:
+        delete static_cast<StyleRuleViewport*>(this);
+        return;
+#endif
     case Unknown:
     case Charset:
     case Keyframe:
@@ -158,6 +169,10 @@ PassRefPtr<StyleRuleBase> StyleRuleBase::copy() const
         return static_cast<const StyleRuleKeyframes*>(this)->copy();
     case Host:
         return static_cast<const StyleRuleHost*>(this)->copy();
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case Viewport:
+        return static_cast<const StyleRuleViewport*>(this)->copy();
+#endif
     case Unknown:
     case Charset:
     case Keyframe:
@@ -199,6 +214,11 @@ PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet
     case Keyframes:
         rule = WebKitCSSKeyframesRule::create(static_cast<StyleRuleKeyframes*>(self), parentSheet);
         break;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case Viewport:
+        rule = WebKitCSSViewportRule::create(static_cast<StyleRuleViewport*>(self), parentSheet);
+        break;
+#endif
     case Host:
     case Unknown:
     case Charset:
@@ -390,4 +410,39 @@ void StyleRuleRegion::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObject
     info.addMember(m_selectorList);
 }
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+StyleRuleViewport::StyleRuleViewport()
+    : StyleRuleBase(Viewport, 0)
+{
+}
+
+StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o)
+    : StyleRuleBase(o)
+    , m_properties(o.m_properties->copy())
+{
+}
+
+StyleRuleViewport::~StyleRuleViewport()
+{
+}
+
+StylePropertySet* StyleRuleViewport::mutableProperties()
+{
+    if (!m_properties->isMutable())
+        m_properties = m_properties->copy();
+    return m_properties.get();
+}
+
+void StyleRuleViewport::setProperties(PassRefPtr<StylePropertySet> properties)
+{
+    m_properties = properties;
+}
+
+void StyleRuleViewport::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(m_properties);
+}
+#endif // ENABLE(CSS_DEVICE_ADAPTATION)
+
 } // namespace WebCore
index b7ff523..4d4340a 100644 (file)
@@ -47,6 +47,9 @@ public:
         Keyframes,
         Keyframe, // Not used. These are internally non-rule StyleKeyframe objects.
         Host,
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+        Viewport = 15,
+#endif
         Region = 16
     };
     Type type() const { return static_cast<Type>(m_type); }
@@ -58,6 +61,9 @@ public:
     bool isPageRule() const { return type() == Page; }
     bool isStyleRule() const { return type() == Style; }
     bool isRegionRule() const { return type() == Region; }
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    bool isViewportRule() const { return type() == Viewport; }
+#endif
     bool isImportRule() const { return type() == Import; }
     bool isHostRule() const { return type() == Host; }
 
@@ -239,6 +245,30 @@ private:
     StyleRuleHost(const StyleRuleHost& o) : StyleRuleBlock(o) { }
 };
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+class StyleRuleViewport : public StyleRuleBase {
+public:
+    static PassRefPtr<StyleRuleViewport> create() { return adoptRef(new StyleRuleViewport); }
+
+    ~StyleRuleViewport();
+
+    const StylePropertySet* properties() const { return m_properties.get(); }
+    StylePropertySet* mutableProperties();
+
+    void setProperties(PassRefPtr<StylePropertySet>);
+
+    PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleViewport(*this)); }
+
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
+private:
+    StyleRuleViewport();
+    StyleRuleViewport(const StyleRuleViewport&);
+
+    RefPtr<StylePropertySet> m_properties;
+};
+#endif // ENABLE(CSS_DEVICE_ADAPTATION)
+
 } // namespace WebCore
 
 #endif // StyleRule_h
diff --git a/Source/WebCore/css/WebKitCSSViewportRule.cpp b/Source/WebCore/css/WebKitCSSViewportRule.cpp
new file mode 100644 (file)
index 0000000..c815b56
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+#include "config.h"
+#include "WebKitCSSViewportRule.h"
+
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+
+#include "PropertySetCSSStyleDeclaration.h"
+#include "StylePropertySet.h"
+#include "StyleRule.h"
+#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+WebKitCSSViewportRule::WebKitCSSViewportRule(StyleRuleViewport* viewportRule, CSSStyleSheet* sheet)
+    : CSSRule(sheet, CSSRule::WEBKIT_VIEWPORT_RULE)
+    , m_viewportRule(viewportRule)
+{
+}
+
+WebKitCSSViewportRule::~WebKitCSSViewportRule()
+{
+    if (m_propertiesCSSOMWrapper)
+        m_propertiesCSSOMWrapper->clearParentRule();
+}
+
+CSSStyleDeclaration* WebKitCSSViewportRule::style() const
+{
+    if (!m_propertiesCSSOMWrapper)
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_viewportRule->mutableProperties(), const_cast<WebKitCSSViewportRule*>(this));
+
+    return m_propertiesCSSOMWrapper.get();
+}
+
+String WebKitCSSViewportRule::cssText() const
+{
+    StringBuilder result;
+    result.appendLiteral("@-webkit-viewport { ");
+
+    String decls = m_viewportRule->properties()->asText();
+    result.append(decls);
+    if (!decls.isEmpty())
+        result.append(' ');
+
+    result.append('}');
+
+    return result.toString();
+}
+
+void WebKitCSSViewportRule::reattach(StyleRuleViewport* rule)
+{
+    ASSERT(rule);
+    m_viewportRule = rule;
+
+    if (m_propertiesCSSOMWrapper)
+        m_propertiesCSSOMWrapper->reattach(m_viewportRule->mutableProperties());
+}
+
+void WebKitCSSViewportRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
+    info.addMember(m_viewportRule);
+    info.addMember(m_propertiesCSSOMWrapper);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CSS_DEVICE_ADAPTATION)
diff --git a/Source/WebCore/css/WebKitCSSViewportRule.h b/Source/WebCore/css/WebKitCSSViewportRule.h
new file mode 100644 (file)
index 0000000..e8a27d1
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebKitCSSViewportRule_h
+#define WebKitCSSViewportRule_h
+
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+
+#include "CSSRule.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class StyleRuleViewport;
+class StyleRuleCSSStyleDeclaration;
+
+class WebKitCSSViewportRule: public CSSRule {
+public:
+    static PassRefPtr<WebKitCSSViewportRule> create(StyleRuleViewport* viewportRule, CSSStyleSheet* sheet)
+    {
+        return adoptRef(new WebKitCSSViewportRule(viewportRule, sheet));
+    }
+    ~WebKitCSSViewportRule();
+
+    CSSStyleDeclaration* style() const;
+
+    String cssText() const;
+
+    void reattach(StyleRuleViewport*);
+
+    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
+
+private:
+    WebKitCSSViewportRule(StyleRuleViewport*, CSSStyleSheet*);
+
+    RefPtr<StyleRuleViewport> m_viewportRule;
+
+    mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
+};
+
+} // namespace WebCore
+
+#endif // WebKitCSSViewportRule_h
+
+#endif // ENABLE(CSS_DEVICE_ADAPTATION)
index 996af5b..f67bdc9 100644 (file)
@@ -56,6 +56,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_DEVICE_ADAPTATION ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_STICKY_POSITION ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_VARIABLES ON)
index cd44e82..31005f5 100644 (file)
@@ -1,3 +1,14 @@
+2012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Added viewport at-rule to the CSS parser and tokenizer
+        https://bugs.webkit.org/show_bug.cgi?id=95961
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Enable CSS Device Adaptation by default on EFL.
+
+        * Scripts/webkitperl/FeatureList.pm:
+
 2012-10-31  Terry Anderson  <tdanderson@chromium.org>
 
         [touchadjustment] touch-links-two-finger-tap test pass incorrectly
index dc2d9cc..90873b9 100644 (file)
@@ -167,7 +167,7 @@ my @features = (
       define => "ENABLE_CSP_NEXT", default => 0, value => \$cspNextSupport },
 
     { option => "css-device-adaptation", desc => "Toggle CSS Device Adaptation support",
-      define => "ENABLE_CSS_DEVICE_ADAPTATION", default => 0, value => \$cssDeviceAdaptation },
+      define => "ENABLE_CSS_DEVICE_ADAPTATION", default => isEfl(), value => \$cssDeviceAdaptation },
 
     { option => "css-exclusions", desc => "Toggle CSS Exclusions support",
       define => "ENABLE_CSS_EXCLUSIONS", default => 1, value => \$cssExclusionsSupport },