Expose DOM interface for CSS Device Adaptation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2012 08:06:32 +0000 (08:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2012 08:06:32 +0000 (08:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95966

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

Source/WebCore:

Added V8 and JSC bindings for CSS Device Adapation.

Test: css3/device-adapt/opera/cssom-001.xhtml

* CMakeLists.txt:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJS):
* bindings/objc/DOMCSS.mm:
(kitClass):
* bindings/v8/custom/V8CSSRuleCustom.cpp:
(WebCore::wrap):
* css/CSSRule.idl:
* css/WebKitCSSViewportRule.idl: Added.
* page/DOMWindow.idl:

LayoutTests:

Imported a test submitted by Opera that tests the exposed interface.

* css3/device-adapt/opera/cssom-001-expected.txt: Added.
* css3/device-adapt/opera/cssom-001.xhtml: Added.
* platform/efl/fast/js/global-constructors-expected.txt:

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/device-adapt/opera/cssom-001-expected.txt [new file with mode: 0644]
LayoutTests/css3/device-adapt/opera/cssom-001.xhtml [new file with mode: 0644]
LayoutTests/platform/efl/fast/js/global-constructors-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
Source/WebCore/bindings/objc/DOMCSS.mm
Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp
Source/WebCore/css/CSSRule.idl
Source/WebCore/css/WebKitCSSViewportRule.idl [new file with mode: 0644]
Source/WebCore/page/DOMWindow.idl

index 04bb7b9..e3fd66c 100644 (file)
@@ -1,3 +1,16 @@
+2012-11-23  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Expose DOM interface for CSS Device Adaptation
+        https://bugs.webkit.org/show_bug.cgi?id=95966
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Imported a test submitted by Opera that tests the exposed interface. 
+
+        * css3/device-adapt/opera/cssom-001-expected.txt: Added.
+        * css3/device-adapt/opera/cssom-001.xhtml: Added.
+        * platform/efl/fast/js/global-constructors-expected.txt:
+
 2012-11-22  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r135549.
diff --git a/LayoutTests/css3/device-adapt/opera/cssom-001-expected.txt b/LayoutTests/css3/device-adapt/opera/cssom-001-expected.txt
new file mode 100644 (file)
index 0000000..9e4d0b5
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS CSS Test: @viewport CSSOM - CSSRule.WEBKIT_VIEWPORT_RULE 
+
diff --git a/LayoutTests/css3/device-adapt/opera/cssom-001.xhtml b/LayoutTests/css3/device-adapt/opera/cssom-001.xhtml
new file mode 100644 (file)
index 0000000..7a4960d
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>CSS Test: @viewport CSSOM - CSSRule.WEBKIT_VIEWPORT_RULE</title>
+  <link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com"/>
+  <link rel="help" href="http://www.w3.org/TR/css-device-adapt/#dom-interfaces"/>
+  <meta name="flags" content="visual scroll dom" />
+  <meta name="assert" content="CSSRule.WEBKIT_VIEWPORT_RULE has the value 15, and the stylesheet contains a CSSViewportRule with type value 15."/>
+  <script src="../../../resources/testharness.js" type="text/javascript" />
+  <script src="../../../resources/testharnessreport.js" type="text/javascript" />
+  <style type="text/css"><![CDATA[
+   body { margin: 0; }
+   html, body, #test { width: 100%; height: 100%; }
+   #log { padding: 1em; display: none; }
+   /* Reset viewport values to initial values to ignore UA stylesheet. */
+   @-webkit-viewport {
+    width: auto;
+    height: auto;
+    zoom: auto;
+    min-zoom: auto;
+    max-zoom: auto;
+    user-zoom: zoom;
+    orientation: auto;
+    resolution: auto;
+   }
+  ]]></style>
+  <style type="text/css"><![CDATA[
+   /* CSS for the test below. */
+   @-webkit-viewport { width: auto 1200px; min-height: 700px; max-zoom: 100% }
+   /* Set root element font-size to something different from the initial
+      font-size to make sure 'rem' and 'em' for @viewport is based on the
+      initial font-size, not the root element font-size. */
+   html { font-size: 2rem; }
+   body { font-size: 0.5rem; }
+  ]]></style>
+  <script type="text/javascript"><![CDATA[
+   var test = async_test("CSS Test: @viewport CSSOM - CSSRule.WEBKIT_VIEWPORT_RULE");
+   window.onload = function(){
+
+    var testStyleSheet = document.styleSheets.item(1);
+
+    /* Disable the stylesheet that contains the @viewport to test. */
+    testStyleSheet.disabled = true;
+
+    /* Initialize an object to store viewport values to be used by the test
+       asserts. */
+    var viewport = new Object();
+
+    /* An element with the same size as the initial containing block. */
+    var testElm = document.getElementById("test");
+
+    /* Retrieve the initial viewport values before applying the @viewport to
+       test. */
+    viewport.initialWidth = testElm.offsetWidth;
+    viewport.initialHeight = testElm.offsetHeight;
+    viewport.fontSize = parseInt(getComputedStyle(testElm, "").fontSize);
+
+    /* Enable the stylesheet that contains the @viewport to test. */
+    testStyleSheet.disabled = false;
+
+    /* Retrieve the actual viewport values for the test. */
+    viewport.actualWidth = testElm.offsetWidth;
+    viewport.actualHeight = testElm.offsetHeight;
+    viewport.zoom = viewport.initialWidth / window.innerWidth;
+
+    /* Check viewport values. */
+    test.step(function(){
+        assert_equals(CSSRule.WEBKIT_VIEWPORT_RULE, 15); assert_equals(testStyleSheet.cssRules.item(0).type, 15);
+    });
+
+    /* Finished. Show the results. */
+    test.done();
+    testStyleSheet.disabled = true;
+    document.getElementById("log").style.display = "block";
+   }
+  ]]></script>
+ </head>
+ <body>
+  <div id="test">
+   <div id="log"></div>
+  </div>
+ </body>
+</html>
index 65fb92e..39fe920 100644 (file)
@@ -332,6 +332,7 @@ PASS WebKitCSSKeyframesRule.toString() is '[object WebKitCSSKeyframesRuleConstru
 PASS WebKitCSSMatrix.toString() is '[object WebKitCSSMatrixConstructor]'
 PASS WebKitCSSRegionRule.toString() is '[object WebKitCSSRegionRuleConstructor]'
 PASS WebKitCSSTransformValue.toString() is '[object WebKitCSSTransformValueConstructor]'
+PASS WebKitCSSViewportRule.toString() is '[object WebKitCSSViewportRuleConstructor]'
 FAIL WebKitIntent.toString() should be [object WebKitIntentConstructor]. Was [object IntentConstructor].
 FAIL WebKitMutationObserver.toString() should be [object WebKitMutationObserverConstructor]. Was [object MutationObserverConstructor].
 PASS WebKitPoint.toString() is '[object WebKitPointConstructor]'
index b078316..7f48a84 100644 (file)
@@ -334,6 +334,7 @@ SET(WebCore_IDL_FILES
     css/WebKitCSSMatrix.idl
     css/WebKitCSSRegionRule.idl
     css/WebKitCSSTransformValue.idl
+    css/WebKitCSSViewportRule.idl
 
     dom/Attr.idl
     dom/BeforeLoadEvent.idl
index c738400..2ef7d36 100644 (file)
@@ -1,3 +1,30 @@
+2012-11-23  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Expose DOM interface for CSS Device Adaptation
+        https://bugs.webkit.org/show_bug.cgi?id=95966
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added V8 and JSC bindings for CSS Device Adapation.
+
+        Test: css3/device-adapt/opera/cssom-001.xhtml
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * DerivedSources.pri:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJS):
+        * bindings/objc/DOMCSS.mm:
+        (kitClass):
+        * bindings/v8/custom/V8CSSRuleCustom.cpp:
+        (WebCore::wrap):
+        * css/CSSRule.idl:
+        * css/WebKitCSSViewportRule.idl: Added.
+        * page/DOMWindow.idl:
+
 2012-11-22  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r135549.
index f8d9ae7..05896f1 100644 (file)
@@ -196,6 +196,7 @@ BINDING_IDLS = \
     $(WebCore)/css/WebKitCSSMatrix.idl \
     $(WebCore)/css/WebKitCSSRegionRule.idl \
     $(WebCore)/css/WebKitCSSTransformValue.idl \
+    $(WebCore)/css/WebKitCSSViewportRule.idl \
     $(WebCore)/dom/Attr.idl \
     $(WebCore)/dom/BeforeLoadEvent.idl \
     $(WebCore)/dom/CDATASection.idl \
index 5437081..3686cc4 100644 (file)
@@ -213,6 +213,7 @@ IDL_BINDINGS += \
     $$PWD/css/WebKitCSSMatrix.idl \
     $$PWD/css/WebKitCSSRegionRule.idl \
     $$PWD/css/WebKitCSSTransformValue.idl \
+    $$PWD/css/WebKitCSSViewportRule.idl \
     $$PWD/dom/Attr.idl \
     $$PWD/dom/BeforeLoadEvent.idl \
     $$PWD/dom/CharacterData.idl \
index cffda8c..deb87bb 100644 (file)
@@ -809,6 +809,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSWebKitCSSRegionRule.h \
        DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp \
        DerivedSources/WebCore/JSWebKitCSSTransformValue.h \
+       DerivedSources/WebCore/JSWebKitCSSViewportRule.cpp \
+       DerivedSources/WebCore/JSWebKitCSSViewportRule.h \
        DerivedSources/WebCore/JSWebKitNamedFlow.cpp \
        DerivedSources/WebCore/JSWebKitNamedFlow.h \
        DerivedSources/WebCore/JSWebKitPoint.cpp \
@@ -1336,6 +1338,7 @@ dom_binding_idls += \
        $(WebCore)/css/WebKitCSSMatrix.idl \
        $(WebCore)/css/WebKitCSSRegionRule.idl \
        $(WebCore)/css/WebKitCSSTransformValue.idl \
+       $(WebCore)/css/WebKitCSSViewportRule.idl \
        $(WebCore)/dom/Attr.idl \
        $(WebCore)/dom/BeforeLoadEvent.idl \
        $(WebCore)/dom/CDATASection.idl \
index 8d0f661..4a01a3c 100644 (file)
             'css/WebKitCSSMatrix.idl',
             'css/WebKitCSSRegionRule.idl',
             'css/WebKitCSSTransformValue.idl',
+            'css/WebKitCSSViewportRule.idl',
             'dom/Attr.idl',
             'dom/BeforeLoadEvent.idl',
             'dom/CDATASection.idl',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValue.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValue.mm',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSTransformValueInternal.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRule.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRule.mm',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWebKitCSSViewportRuleInternal.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWheelEvent.mm',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMWheelEventInternal.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMXPathExpression.mm',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSRegionRule.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSTransformValue.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.cpp',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitCSSViewportRule.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitPoint.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitPoint.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebKitNamedFlow.cpp',
index 752c106..f7173f8 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 */; };
+               3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */; };
+               3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */; };
+               3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */; };
+               3F2B33EE165AF15600E3987C /* JSWebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */; };
+               3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */; };
                3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; };
                3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */; };
                3FFFF9AD159D9B060020BBD5 /* ViewportStyleResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.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>"; };
+               3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSViewportRule.idl; sourceTree = "<group>"; };
+               3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSViewportRule.h; sourceTree = "<group>"; };
+               3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitCSSViewportRule.mm; sourceTree = "<group>"; };
+               3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSViewportRuleInternal.h; sourceTree = "<group>"; };
+               3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSViewportRule.cpp; sourceTree = "<group>"; };
+               3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSViewportRule.h; 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>"; };
                3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportStyleResolver.cpp; sourceTree = "<group>"; };
                                31611E5E0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h */,
                                31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */,
                                31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */,
+                               3F2B33E6165AF15500E3987C /* DOMWebKitCSSViewportRule.h */,
+                               3F2B33E7165AF15500E3987C /* DOMWebKitCSSViewportRule.mm */,
+                               3F2B33E8165AF15500E3987C /* DOMWebKitCSSViewportRuleInternal.h */,
                        );
                        name = CSS;
                        sourceTree = "<group>";
                                8ACC24CE148E24B200EFCC0D /* JSWebKitCSSRegionRule.h */,
                                31611E580E1C4DE000F6A579 /* JSWebKitCSSTransformValue.cpp */,
                                31611E590E1C4DE000F6A579 /* JSWebKitCSSTransformValue.h */,
+                               3F2B33E9165AF15500E3987C /* JSWebKitCSSViewportRule.cpp */,
+                               3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */,
                        );
                        name = CSS;
                        sourceTree = "<group>";
                                31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */,
                                3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
                                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
+                               3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
                        );
                        path = css;
                        sourceTree = "<group>";
                                50D32858163B313F0016111E /* ValidatedCustomFilterOperation.h in Headers */,
                                3FFFF9AE159D9B060020BBD5 /* ViewportStyleResolver.h in Headers */,
                                3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */,
+                               3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */,
+                               3F2B33ED165AF15600E3987C /* DOMWebKitCSSViewportRuleInternal.h in Headers */,
+                               3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */,
                                93C38BFF164473C700091EB2 /* ScrollingStateFixedNode.h in Headers */,
                                93C38C03164473DD00091EB2 /* ScrollingTreeFixedNode.h in Headers */,
                                E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */,
                                1AA21250163F0DA80000E63F /* AtomicStringCF.cpp in Sources */,
                                50D32857163B313F0016111E /* ValidatedCustomFilterOperation.cpp in Sources */,
                                3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */,
+                               3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */,
+                               3F2B33EE165AF15600E3987C /* JSWebKitCSSViewportRule.cpp in Sources */,
                                4FFC022B1643B710004E1638 /* NodeRareData.cpp in Sources */,
                                4FFC022D1643B726004E1638 /* ElementRareData.cpp in Sources */,
                                93C38BFE164473C700091EB2 /* ScrollingStateFixedNode.cpp in Sources */,
index a25cc54..2a465dc 100644 (file)
 #include "JSWebKitCSSKeyframeRule.h"
 #include "JSWebKitCSSKeyframesRule.h"
 #include "JSWebKitCSSRegionRule.h"
+#include "JSWebKitCSSViewportRule.h"
 #include "WebKitCSSKeyframeRule.h"
 #include "WebKitCSSKeyframesRule.h"
 #include "WebKitCSSRegionRule.h"
+#include "WebKitCSSViewportRule.h"
 
 using namespace JSC;
 
@@ -94,6 +96,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule)
         case CSSRule::WEBKIT_KEYFRAMES_RULE:
             wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSKeyframesRule, rule);
             break;
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+        case CSSRule::WEBKIT_VIEWPORT_RULE:
+            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSViewportRule, rule);
+            break;
+#endif
 #if ENABLE(CSS_REGIONS)
         case CSSRule::WEBKIT_REGION_RULE:
             wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitCSSRegionRule, rule);
index 1adabff..3c1da82 100644 (file)
 #import "DOMWebKitCSSRegionRule.h"
 #endif
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+#import "DOMWebKitCSSViewportRule.h"
+#endif
+
 #if ENABLE(SVG_DOM_OBJC_BINDINGS)
 #import "DOMSVGPaint.h"
 #endif
@@ -95,6 +99,10 @@ Class kitClass(WebCore::CSSRule* impl)
             return [DOMWebKitCSSKeyframesRule class];
         case DOM_WEBKIT_KEYFRAME_RULE:
             return [DOMWebKitCSSKeyframeRule class];
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+        case DOM_WEBKIT_VIEWPORT_RULE:
+            return [DOMWebKitCSSViewportRule class];
+#endif
 #if ENABLE(CSS_REGIONS)
         case DOM_WEBKIT_REGION_RULE:
             return [DOMWebKitCSSRegionRule class];
index 172649d..d151cd8 100644 (file)
 #include "V8WebKitCSSKeyframesRule.h"
 #include "V8WebKitCSSRegionRule.h"
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+#include "V8WebKitCSSViewportRule.h"
+#endif
+
 namespace WebCore {
 
 v8::Handle<v8::Object> wrap(CSSRule* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
@@ -68,6 +72,10 @@ v8::Handle<v8::Object> wrap(CSSRule* impl, v8::Handle<v8::Object> creationContex
         return wrap(static_cast<WebKitCSSKeyframeRule*>(impl), creationContext, isolate);
     case CSSRule::WEBKIT_KEYFRAMES_RULE:
         return wrap(static_cast<WebKitCSSKeyframesRule*>(impl), creationContext, isolate);
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    case CSSRule::WEBKIT_VIEWPORT_RULE:
+        return wrap(static_cast<WebKitCSSViewportRule*>(impl), creationContext, isolate);
+#endif
     case CSSRule::WEBKIT_REGION_RULE:
         return wrap(static_cast<WebKitCSSRegionRule*>(impl), creationContext, isolate);
     }
index 585adab..af118fe 100644 (file)
@@ -37,6 +37,9 @@
     const unsigned short PAGE_RULE = 6;
     const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
     const unsigned short WEBKIT_KEYFRAME_RULE = 8;
+#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION
+    const unsigned short WEBKIT_VIEWPORT_RULE = 15;
+#endif
 #if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
     const unsigned short WEBKIT_REGION_RULE = 16;
 #endif
diff --git a/Source/WebCore/css/WebKitCSSViewportRule.idl b/Source/WebCore/css/WebKitCSSViewportRule.idl
new file mode 100644 (file)
index 0000000..a194922
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+[
+    Conditional=CSS_DEVICE_ADAPTATION,
+] interface WebKitCSSViewportRule : CSSRule {
+    readonly attribute CSSStyleDeclaration style;
+};
index abda367..db7c09d 100644 (file)
     attribute WebKitCSSFilterValueConstructor WebKitCSSFilterValue;
 #endif
 
+#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION
+    attribute WebKitCSSViewportRuleConstructor WebKitCSSViewportRule;
+#endif
+
     attribute CSSRuleConstructor CSSRule;
     attribute CSSCharsetRuleConstructor CSSCharsetRule;
     attribute CSSFontFaceRuleConstructor CSSFontFaceRule;