Changeset 133084 in webkit


Ignore:
Timestamp:
Oct 31, 2012 3:22:07 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Added viewport at-rule to the CSS parser and tokenizer
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:
Location:
trunk
Files:
5 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r133033 r133084  
     12012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Added viewport at-rule to the CSS parser and tokenizer
     4        https://bugs.webkit.org/show_bug.cgi?id=95961
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Enable CSS Device Adaptation by default on EFL.
     9
     10        * Source/cmake/OptionsEfl.cmake:
     11
    1122012-10-31  Ian Vollick  <vollick@chromium.org>
    213
  • trunk/LayoutTests/ChangeLog

    r133083 r133084  
     12012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Added viewport at-rule to the CSS parser and tokenizer
     4        https://bugs.webkit.org/show_bug.cgi?id=95961
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added a test that detects if the @-webkit-viewport rule is being
     9        parsed and skip the tests on all ports since the feature is disabled
     10        by default for instance.
     11
     12        Note that this test doesn't do property validation, which will be
     13        added in the next patch of the series.
     14
     15        * css3/device-adapt/viewport-at-rule-parsing-expected.txt: Added.
     16        * css3/device-adapt/viewport-at-rule-parsing.html: Added.
     17        * platform/chromium/TestExpectations:
     18        * platform/gtk/TestExpectations:
     19        * platform/mac/TestExpectations:
     20        * platform/qt/TestExpectations:
     21        * platform/win/TestExpectations:
     22        * platform/wincairo/TestExpectations:
     23
    1242012-10-31  Max Vujovic  <mvujovic@adobe.com>
    225
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r133081 r133084  
    40284028webkit.org/b/86146 css3/supports.html
    40294029
     4030# CSS Device Adaptation is not enabled.
     4031webkit.org/b/95959 css3/device-adapt [ Skip ]
     4032
    40304033# Require rebaselining after webkit.org/b/97800
    40314034webkit.org/b/89167 media/track/track-cue-rendering-horizontal.html [ Failure ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r133037 r133084  
    14371437# End of Tests failing
    14381438#////////////////////////////////////////////////////////////////////////////////////////
     1439
     1440# CSS Device Adaptation is not enabled.
     1441webkit.org/b/95959 css3/device-adapt [ Skip ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r133074 r133084  
    13171317webkit.org/b/86146 css3/supports.html
    13181318
     1319# CSS Device Adaptation is not enabled.
     1320webkit.org/b/95959 css3/device-adapt [ Skip ]
     1321
    13191322# Hardware accelerated CSS transitions appear pixelated when scaled up using transform
    13201323webkit.org/b/27684 compositing/text-on-scaled-layer.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/qt/TestExpectations

    r133074 r133084  
    24762476webkit.org/b/86146 css3/supports.html
    24772477
     2478# CSS Device Adaptation is not enabled.
     2479webkit.org/b/95969 css3/device-adapt [ Skip ]
     2480
    24782481# Added by bug 89826
    24792482webkit.org/b/94005 css2.1/20110323/word-spacing-remove-space-003.htm [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/win/TestExpectations

    r133037 r133084  
    880880# BlodBuilder is not enabled
    881881http/tests/local/blob/send-data-blob.html
     882
     883# CSS Device Adaptation is not enabled.
     884webkit.org/b/95959 css3/device-adapt [ Skip ]
    882885
    883886# <https://bugs.webkit.org/show_bug.cgi?id=29289>
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r133030 r133084  
    28092809http/tests/xmlhttprequest/range-test.html
    28102810
     2811# CSS Device Adaptation is not enabled.
     2812webkit.org/b/95959 css3/device-adapt [ Skip ]
     2813
    28112814# css3-conditionals support is not yet enabled.
    28122815webkit.org/b/86146 css3/supports.html
  • trunk/Source/WebCore/CMakeLists.txt

    r133028 r133084  
    11041104    css/WebKitCSSShaderValue.cpp
    11051105    css/WebKitCSSTransformValue.cpp
     1106    css/WebKitCSSViewportRule.cpp
    11061107
    11071108    dom/ActiveDOMObject.cpp
  • trunk/Source/WebCore/ChangeLog

    r133083 r133084  
     12012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Added viewport at-rule to the CSS parser and tokenizer
     4        https://bugs.webkit.org/show_bug.cgi?id=95961
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Add tokens and grammar rules to parse @-webkit-viewport blocks. Also add
     9        the newly parsed rule to the rule list.
     10
     11        This parser now implements the following part of the CSS Device Adaptation
     12        specification: http://www.w3.org/TR/css-device-adapt/#syntax
     13
     14        Test: css3/device-adapt/viewport-at-rule-parsing.html
     15
     16        * CMakeLists.txt:
     17        * GNUmakefile.list.am:
     18        * Target.pri:
     19        * WebCore.gypi:
     20        * WebCore.vcproj/WebCore.vcproj:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * css/CSSGrammar.y.in:
     23        * css/CSSParser.cpp:
     24        (WebCore::CSSParser::CSSParser):
     25        (WebCore::CSSParser::detectAtToken):
     26        (WebCore):
     27        (WebCore::CSSParser::createViewportRule):
     28        * css/CSSParser.h:
     29        (CSSParser):
     30        (WebCore::CSSParser::markViewportRuleBodyStart):
     31        (WebCore::CSSParser::markViewportRuleBodyEnd):
     32        (WebCore::CSSParser::inViewport):
     33
     34            These methods are needed by the next patch validating the properties.
     35            Some viewport properties are common to other rules but have different
     36            semantics, and accepts different keywords. The validation needs to be
     37            done in a different code path.
     38
     39        * css/CSSPropertySourceData.h:
     40        * css/CSSRule.cpp:
     41        (WebCore):
     42        (WebCore::CSSRule::cssText):
     43        (WebCore::CSSRule::destroy):
     44        (WebCore::CSSRule::reattach):
     45        (WebCore::CSSRule::reportMemoryUsage):
     46        * css/CSSRule.h:
     47        (CSSRule):
     48        (WebCore::CSSRule::isViewportRule):
     49        * css/StyleRule.cpp:
     50        (WebCore::StyleRuleBase::reportMemoryUsage):
     51        (WebCore::StyleRuleBase::destroy):
     52        (WebCore::StyleRuleBase::copy):
     53        (WebCore::StyleRuleBase::createCSSOMWrapper):
     54        (WebCore):
     55        (WebCore::StyleRuleViewport::StyleRuleViewport):
     56        (WebCore::StyleRuleViewport::~StyleRuleViewport):
     57        (WebCore::StyleRuleViewport::mutableProperties):
     58        (WebCore::StyleRuleViewport::setProperties):
     59        (WebCore::StyleRuleViewport::reportDescendantMemoryUsage):
     60        * css/StyleRule.h:
     61        (StyleRuleBase):
     62        (WebCore::StyleRuleBase::isViewportRule):
     63        (WebCore):
     64        (StyleRuleViewport):
     65        (WebCore::StyleRuleViewport::create):
     66        (WebCore::StyleRuleViewport::properties):
     67        (WebCore::StyleRuleViewport::copy):
     68        * css/WebKitCSSViewportRule.cpp: Added.
     69        (WebCore):
     70        (WebCore::WebKitCSSViewportRule::WebKitCSSViewportRule):
     71        (WebCore::WebKitCSSViewportRule::~WebKitCSSViewportRule):
     72        (WebCore::WebKitCSSViewportRule::style):
     73        (WebCore::WebKitCSSViewportRule::cssText):
     74        (WebCore::WebKitCSSViewportRule::reattach):
     75        (WebCore::WebKitCSSViewportRule::reportDescendantMemoryUsage):
     76        * css/WebKitCSSViewportRule.h: Added.
     77        (WebCore):
     78
    1792012-10-31  Max Vujovic  <mvujovic@adobe.com>
    280
  • trunk/Source/WebCore/GNUmakefile.list.am

    r133028 r133084  
    26902690        Source/WebCore/css/WebKitCSSTransformValue.cpp \
    26912691        Source/WebCore/css/WebKitCSSTransformValue.h \
     2692        Source/WebCore/css/WebKitCSSViewportRule.cpp \
     2693        Source/WebCore/css/WebKitCSSViewportRule.h \
    26922694        Source/WebCore/dom/ActiveDOMObject.cpp \
    26932695        Source/WebCore/dom/ActiveDOMObject.h \
  • trunk/Source/WebCore/Target.pri

    r133028 r133084  
    340340    css/WebKitCSSShaderValue.cpp \
    341341    css/WebKitCSSTransformValue.cpp \
     342    css/WebKitCSSViewportRule.cpp \
    342343    dom/ActiveDOMObject.cpp \
    343344    dom/Attr.cpp \
     
    15131514    css/WebKitCSSShaderValue.h \
    15141515    css/WebKitCSSTransformValue.h \
     1516    css/WebKitCSSViewportRule.h \
    15151517    dom/ActiveDOMObject.h \
    15161518    dom/Attr.h \
  • trunk/Source/WebCore/WebCore.gypi

    r133028 r133084  
    26772677            'css/WebKitCSSSVGDocumentValue.h',
    26782678            'css/WebKitCSSTransformValue.cpp',
     2679            'css/WebKitCSSViewportRule.h',
     2680            'css/WebKitCSSViewportRule.cpp',
    26792681            'editing/AlternativeTextController.cpp',
    26802682            'editing/AlternativeTextController.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r133028 r133084  
    3820838208                        </File>
    3820938209                        <File
     38210                                RelativePath="..\css\WebKitCSSViewportRule.cpp"
     38211                                >
     38212                        </File>
     38213                        <File
     38214                                RelativePath="..\css\WebKitCSSViewportRule.h"
     38215                                >
     38216                        </File>
     38217                        <File
    3821038218                            RelativePath="..\css\BasicShapeFunctions.h"
    3821138219                            >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r133028 r133084  
    10321032                3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10331033                3C244FEBA375AC633F88BE6F /* RenderLayerModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */; };
     1034                3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; };
     1035                3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */; };
    10341036                41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */; };
    10351037                41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */; };
     
    81888190                3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerModelObject.h; sourceTree = "<group>"; };
    81898191                3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerModelObject.cpp; sourceTree = "<group>"; };
     8192                3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSViewportRule.cpp; sourceTree = "<group>"; };
     8193                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSViewportRule.h; sourceTree = "<group>"; };
    81908194                41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
    81918195                41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
     
    2142721431                                BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */,
    2142821432                                31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */,
     21433                                3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
     21434                                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
    2142921435                        );
    2143021436                        path = css;
     
    2570425710                                50933350163B0E4300099A60 /* CustomFilterParameterList.h in Headers */,
    2570525711                                50D32858163B313F0016111E /* ValidatedCustomFilterOperation.h in Headers */,
     25712                                3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */,
    2570625713                        );
    2570725714                        runOnlyForDeploymentPostprocessing = 0;
     
    2878928796                                1AA21250163F0DA80000E63F /* AtomicStringCF.cpp in Sources */,
    2879028797                                50D32857163B313F0016111E /* ValidatedCustomFilterOperation.cpp in Sources */,
     28798                                3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */,
    2879128799                        );
    2879228800                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r132618 r133084  
    44 *  Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    55 *  Copyright (C) 2008 Eric Seidel <eric@webkit.org>
     6 *  Copyright (C) 2012 Intel Corporation. All rights reserved.
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    110111%token WEBKIT_SELECTOR_SYM
    111112%token WEBKIT_REGION_RULE_SYM
     113%token WEBKIT_VIEWPORT_RULE_SYM
    112114%token <marginBox> TOPLEFTCORNER_SYM
    113115%token <marginBox> TOPLEFT_SYM
     
    207209%type <rule> supports
    208210#endif
     211#if ENABLE_CSS_DEVICE_ADAPTATION
     212%type <rule> viewport
     213#endif
    209214
    210215%type <string> maybe_ns_prefix
     
    412417  | host
    413418#endif
     419#if ENABLE_CSS_DEVICE_ADAPTATION
     420  | viewport
     421#endif
    414422  ;
    415423
     
    440448  | font_face
    441449  | keyframes
     450#if ENABLE_CSS_DEVICE_ADAPTATION
     451  | viewport
     452#endif
    442453  ;
    443454
     
    928939    }
    929940    ;
     941#endif
     942
     943#if ENABLE_CSS_DEVICE_ADAPTATION
     944before_viewport_rule:
     945    /* empty */ {
     946        parser->markViewportRuleBodyStart();
     947        parser->markRuleHeaderStart(CSSRuleSourceData::VIEWPORT_RULE);
     948    }
     949    ;
     950
     951viewport:
     952    before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM at_rule_header_end_maybe_space
     953    '{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
     954        $$ = parser->createViewportRule();
     955        parser->markViewportRuleBodyEnd();
     956    }
     957    | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error invalid_block {
     958        $$ = 0;
     959        parser->popRuleData();
     960        parser->markViewportRuleBodyEnd();
     961    }
     962    | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error ';' {
     963        $$ = 0;
     964        parser->popRuleData();
     965        parser->markViewportRuleBodyEnd();
     966    }
     967;
    930968#endif
    931969
  • trunk/Source/WebCore/css/CSSParser.cpp

    r133029 r133084  
    270270    , m_allowImportRules(true)
    271271    , m_allowNamespaceDeclarations(true)
     272#if ENABLE(CSS_DEVICE_ADAPTATION)
     273    , m_inViewport(false)
     274#endif
    272275    , m_selectorVector(adoptPtr(new CSSSelectorVector))
    273276{
     
    93199322
    93209323        case 17:
    9321             if (!hasEscape && isEqualToCSSIdentifier(name + 2, "webkit-selector"))
     9324            if (hasEscape)
     9325                return;
     9326
     9327            if (isASCIIAlphaCaselessEqual(name[16], 'r') && isEqualToCSSIdentifier(name + 2, "webkit-selecto"))
    93229328                m_token = WEBKIT_SELECTOR_SYM;
     9329#if ENABLE(CSS_DEVICE_ADAPTATION)
     9330            else if (isASCIIAlphaCaselessEqual(name[16], 't') && isEqualToCSSIdentifier(name + 2, "webkit-viewpor"))
     9331                m_token = WEBKIT_VIEWPORT_RULE_SYM;
     9332#endif
    93239333            return;
    93249334
     
    1039310403}
    1039410404
     10405#if ENABLE(CSS_DEVICE_ADAPTATION)
     10406StyleRuleBase* CSSParser::createViewportRule()
     10407{
     10408    m_allowImportRules = m_allowNamespaceDeclarations = false;
     10409
     10410    RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create();
     10411
     10412    rule->setProperties(createStylePropertySet());
     10413    clearProperties();
     10414
     10415    StyleRuleViewport* result = rule.get();
     10416    m_parsedRules.append(rule.release());
     10417    processAndAddNewRuleToSourceTreeIfNeeded();
     10418
     10419    return result;
     10420}
     10421#endif
     10422
    1039510423template <typename CharacterType>
    1039610424static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned length)
  • trunk/Source/WebCore/css/CSSParser.h

    r132786 r133084  
    367367    int token() { return m_token; }
    368368
     369#if ENABLE(CSS_DEVICE_ADAPTATION)
     370    void markViewportRuleBodyStart() { m_inViewport = true; }
     371    void markViewportRuleBodyEnd() { m_inViewport = false; }
     372    StyleRuleBase* createViewportRule();
     373#endif
     374
    369375    PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
    370376    PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
     
    514520    bool m_allowNamespaceDeclarations;
    515521
     522#if ENABLE(CSS_DEVICE_ADAPTATION)
     523    bool inViewport() const { return m_inViewport; }
     524    bool m_inViewport;
     525#endif
     526
    516527    int (CSSParser::*m_lexFunc)(void*);
    517528
  • trunk/Source/WebCore/css/CSSPropertySourceData.h

    r132618 r133084  
    9696        KEYFRAMES_RULE,
    9797        REGION_RULE,
    98         HOST_RULE
     98        HOST_RULE,
     99        VIEWPORT_RULE
    99100    };
    100101
  • trunk/Source/WebCore/css/CSSRule.cpp

    r129365 r133084  
    3131#include "CSSStyleSheet.h"
    3232#include "CSSUnknownRule.h"
     33#include "NotImplemented.h"
     34#include "StyleRule.h"
     35#include "StyleSheetContents.h"
    3336#include "WebKitCSSKeyframeRule.h"
    3437#include "WebKitCSSKeyframesRule.h"
    3538#include "WebKitCSSRegionRule.h"
    36 #include "NotImplemented.h"
    37 #include "StyleRule.h"
    38 #include "StyleSheetContents.h"
     39#include "WebKitCSSViewportRule.h"
    3940
    4041namespace WebCore {
     
    5152#endif
    5253
     54#if ENABLE(CSS_DEVICE_ADAPTATION)
     55COMPILE_ASSERT(StyleRuleBase::Viewport == static_cast<StyleRuleBase::Type>(CSSRule::WEBKIT_VIEWPORT_RULE), enums_should_match);
     56#endif
     57
    5358void CSSRule::setCssText(const String& /*cssText*/, ExceptionCode& /*ec*/)
    5459{
     
    7782    case WEBKIT_KEYFRAME_RULE:
    7883        return static_cast<const WebKitCSSKeyframeRule*>(this)->cssText();
     84#if ENABLE(CSS_DEVICE_ADAPTATION)
     85    case WEBKIT_VIEWPORT_RULE:
     86        return static_cast<const WebKitCSSViewportRule*>(this)->cssText();
     87#endif
    7988#if ENABLE(CSS_REGIONS)
    8089    case WEBKIT_REGION_RULE:
     
    116125        delete static_cast<WebKitCSSKeyframeRule*>(this);
    117126        return;
     127#if ENABLE(CSS_DEVICE_ADAPTATION)
     128    case WEBKIT_VIEWPORT_RULE:
     129        delete static_cast<WebKitCSSViewportRule*>(this);
     130        return;
     131#endif
    118132#if ENABLE(CSS_REGIONS)
    119133    case WEBKIT_REGION_RULE:
     
    156170        ASSERT_NOT_REACHED();
    157171        return;
     172#if ENABLE(CSS_DEVICE_ADAPTATION)
     173    case WEBKIT_VIEWPORT_RULE:
     174        static_cast<WebKitCSSViewportRule*>(this)->reattach(static_cast<StyleRuleViewport*>(rule));
     175        return;
     176#endif
    158177#if ENABLE(CSS_REGIONS)
    159178    case WEBKIT_REGION_RULE:
     
    195214        static_cast<const WebKitCSSKeyframeRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
    196215        return;
     216#if ENABLE(CSS_DEVICE_ADAPTATION)
     217    case WEBKIT_VIEWPORT_RULE:
     218        static_cast<const WebKitCSSViewportRule*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
     219        return;
     220#endif
    197221#if ENABLE(CSS_REGIONS)
    198222    case WEBKIT_REGION_RULE:
  • trunk/Source/WebCore/css/CSSRule.h

    r129365 r133084  
    5858        WEBKIT_KEYFRAMES_RULE,
    5959        WEBKIT_KEYFRAME_RULE,
     60#if ENABLE(CSS_DEVICE_ADAPTATION)
     61        WEBKIT_VIEWPORT_RULE = 15,
     62#endif
    6063#if ENABLE(CSS_REGIONS)
    6164        WEBKIT_REGION_RULE = 16
     
    7376    bool isStyleRule() const { return type() == STYLE_RULE; }
    7477    bool isImportRule() const { return type() == IMPORT_RULE; }
     78
     79#if ENABLE(CSS_DEVICE_ADAPTATION)
     80    bool isViewportRule() const { return type() == WEBKIT_VIEWPORT_RULE; }
     81#endif
    7582
    7683#if ENABLE(CSS_REGIONS)
  • trunk/Source/WebCore/css/StyleRule.cpp

    r132618 r133084  
    3434#include "WebKitCSSKeyframesRule.h"
    3535#include "WebKitCSSRegionRule.h"
     36#include "WebKitCSSViewportRule.h"
    3637#include <wtf/MemoryInstrumentationVector.h>
    3738
     
    8384        static_cast<const StyleRuleBlock*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
    8485        return;
     86#if ENABLE(CSS_DEVICE_ADAPTATION)
     87    case Viewport:
     88        static_cast<const StyleRuleViewport*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
     89        return;
     90#endif
    8591    case Unknown:
    8692    case Charset:
     
    124130        delete static_cast<StyleRuleHost*>(this);
    125131        return;
     132#if ENABLE(CSS_DEVICE_ADAPTATION)
     133    case Viewport:
     134        delete static_cast<StyleRuleViewport*>(this);
     135        return;
     136#endif
    126137    case Unknown:
    127138    case Charset:
     
    159170    case Host:
    160171        return static_cast<const StyleRuleHost*>(this)->copy();
     172#if ENABLE(CSS_DEVICE_ADAPTATION)
     173    case Viewport:
     174        return static_cast<const StyleRuleViewport*>(this)->copy();
     175#endif
    161176    case Unknown:
    162177    case Charset:
     
    200215        rule = WebKitCSSKeyframesRule::create(static_cast<StyleRuleKeyframes*>(self), parentSheet);
    201216        break;
     217#if ENABLE(CSS_DEVICE_ADAPTATION)
     218    case Viewport:
     219        rule = WebKitCSSViewportRule::create(static_cast<StyleRuleViewport*>(self), parentSheet);
     220        break;
     221#endif
    202222    case Host:
    203223    case Unknown:
     
    391411}
    392412
     413#if ENABLE(CSS_DEVICE_ADAPTATION)
     414StyleRuleViewport::StyleRuleViewport()
     415    : StyleRuleBase(Viewport, 0)
     416{
     417}
     418
     419StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o)
     420    : StyleRuleBase(o)
     421    , m_properties(o.m_properties->copy())
     422{
     423}
     424
     425StyleRuleViewport::~StyleRuleViewport()
     426{
     427}
     428
     429StylePropertySet* StyleRuleViewport::mutableProperties()
     430{
     431    if (!m_properties->isMutable())
     432        m_properties = m_properties->copy();
     433    return m_properties.get();
     434}
     435
     436void StyleRuleViewport::setProperties(PassRefPtr<StylePropertySet> properties)
     437{
     438    m_properties = properties;
     439}
     440
     441void StyleRuleViewport::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     442{
     443    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     444    info.addMember(m_properties);
     445}
     446#endif // ENABLE(CSS_DEVICE_ADAPTATION)
     447
    393448} // namespace WebCore
  • trunk/Source/WebCore/css/StyleRule.h

    r132618 r133084  
    4848        Keyframe, // Not used. These are internally non-rule StyleKeyframe objects.
    4949        Host,
     50#if ENABLE(CSS_DEVICE_ADAPTATION)
     51        Viewport = 15,
     52#endif
    5053        Region = 16
    5154    };
     
    5962    bool isStyleRule() const { return type() == Style; }
    6063    bool isRegionRule() const { return type() == Region; }
     64#if ENABLE(CSS_DEVICE_ADAPTATION)
     65    bool isViewportRule() const { return type() == Viewport; }
     66#endif
    6167    bool isImportRule() const { return type() == Import; }
    6268    bool isHostRule() const { return type() == Host; }
     
    240246};
    241247
     248#if ENABLE(CSS_DEVICE_ADAPTATION)
     249class StyleRuleViewport : public StyleRuleBase {
     250public:
     251    static PassRefPtr<StyleRuleViewport> create() { return adoptRef(new StyleRuleViewport); }
     252
     253    ~StyleRuleViewport();
     254
     255    const StylePropertySet* properties() const { return m_properties.get(); }
     256    StylePropertySet* mutableProperties();
     257
     258    void setProperties(PassRefPtr<StylePropertySet>);
     259
     260    PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleViewport(*this)); }
     261
     262    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
     263
     264private:
     265    StyleRuleViewport();
     266    StyleRuleViewport(const StyleRuleViewport&);
     267
     268    RefPtr<StylePropertySet> m_properties;
     269};
     270#endif // ENABLE(CSS_DEVICE_ADAPTATION)
     271
    242272} // namespace WebCore
    243273
  • trunk/Source/cmake/OptionsEfl.cmake

    r132627 r133084  
    5757WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
    5858WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT ON)
     59WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_DEVICE_ADAPTATION ON)
    5960WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON)
    6061WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_STICKY_POSITION ON)
  • trunk/Tools/ChangeLog

    r133082 r133084  
     12012-10-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Added viewport at-rule to the CSS parser and tokenizer
     4        https://bugs.webkit.org/show_bug.cgi?id=95961
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Enable CSS Device Adaptation by default on EFL.
     9
     10        * Scripts/webkitperl/FeatureList.pm:
     11
    1122012-10-31  Terry Anderson  <tdanderson@chromium.org>
    213
  • trunk/Tools/Scripts/webkitperl/FeatureList.pm

    r132600 r133084  
    168168
    169169    { option => "css-device-adaptation", desc => "Toggle CSS Device Adaptation support",
    170       define => "ENABLE_CSS_DEVICE_ADAPTATION", default => 0, value => \$cssDeviceAdaptation },
     170      define => "ENABLE_CSS_DEVICE_ADAPTATION", default => isEfl(), value => \$cssDeviceAdaptation },
    171171
    172172    { option => "css-exclusions", desc => "Toggle CSS Exclusions support",
Note: See TracChangeset for help on using the changeset viewer.