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
+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
+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
--- /dev/null
+
+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
+
--- /dev/null
+<!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>
# 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 ]
#////////////////////////////////////////////////////////////////////////////////////////
# End of Tests failing
#////////////////////////////////////////////////////////////////////////////////////////
+
+# 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
+# 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 ]
# 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 ]
# 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
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
css/WebKitCSSSVGDocumentValue.cpp
css/WebKitCSSShaderValue.cpp
css/WebKitCSSTransformValue.cpp
+ css/WebKitCSSViewportRule.cpp
dom/ActiveDOMObject.cpp
dom/Attr.cpp
+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
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 \
css/WebKitCSSSVGDocumentValue.cpp \
css/WebKitCSSShaderValue.cpp \
css/WebKitCSSTransformValue.cpp \
+ css/WebKitCSSViewportRule.cpp \
dom/ActiveDOMObject.cpp \
dom/Attr.cpp \
dom/BeforeTextInsertedEvent.cpp \
css/WebKitCSSSVGDocumentValue.h \
css/WebKitCSSShaderValue.h \
css/WebKitCSSTransformValue.h \
+ css/WebKitCSSViewportRule.h \
dom/ActiveDOMObject.h \
dom/Attr.h \
dom/Attribute.h \
'css/WebKitCSSSVGDocumentValue.cpp',
'css/WebKitCSSSVGDocumentValue.h',
'css/WebKitCSSTransformValue.cpp',
+ 'css/WebKitCSSViewportRule.h',
+ 'css/WebKitCSSViewportRule.cpp',
'editing/AlternativeTextController.cpp',
'editing/AlternativeTextController.h',
'editing/AppendNodeCommand.cpp',
>
</File>
<File
+ RelativePath="..\css\WebKitCSSViewportRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\css\WebKitCSSViewportRule.h"
+ >
+ </File>
+ <File
RelativePath="..\css\BasicShapeFunctions.h"
>
</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;
};
* 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
%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
#if ENABLE_CSS3_CONDITIONAL_RULES
%type <rule> supports
#endif
+#if ENABLE_CSS_DEVICE_ADAPTATION
+%type <rule> viewport
+#endif
%type <string> maybe_ns_prefix
#if ENABLE_SHADOW_DOM
| host
#endif
+#if ENABLE_CSS_DEVICE_ADAPTATION
+ | viewport
+#endif
;
rule:
| page
| font_face
| keyframes
+#if ENABLE_CSS_DEVICE_ADAPTATION
+ | viewport
+#endif
;
block_rule:
;
#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) {
, 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
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:
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)
{
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)
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;
PAGE_RULE,
KEYFRAMES_RULE,
REGION_RULE,
- HOST_RULE
+ HOST_RULE,
+ VIEWPORT_RULE
};
static PassRefPtr<CSSRuleSourceData> create(Type type)
#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 {
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();
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();
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);
// 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));
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);
// <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
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
#include "WebKitCSSKeyframeRule.h"
#include "WebKitCSSKeyframesRule.h"
#include "WebKitCSSRegionRule.h"
+#include "WebKitCSSViewportRule.h"
#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
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:
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:
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:
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:
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
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); }
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; }
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
--- /dev/null
+/*
+ * 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)
--- /dev/null
+/*
+ * 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)
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)
+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
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 },