Commit 51e2fadf authored by hyatt@apple.com's avatar hyatt@apple.com

WebCore:

2008-06-19  David Hyatt  <hyatt@apple.com>

        Add initial support for CSS variables.  Non-dynamic cases should (hopefully) all work.  Things will get
        confused if you use the CSS OM to remove variables/inject variables, etc.  In addition no DOM APIs are
        exposed yet for the new variable interfaces.

        Reviewed by Beth

        Added many tests to fast/css/variables/

        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSFunctionValue.cpp: Added.
        (WebCore::CSSFunctionValue::CSSFunctionValue):
        (WebCore::CSSFunctionValue::~CSSFunctionValue):
        (WebCore::CSSFunctionValue::cssText):
        (WebCore::CSSFunctionValue::parserValue):
        * css/CSSFunctionValue.h: Added.
        (WebCore::CSSFunctionValue::create):
        * css/CSSGrammar.y:
        * css/CSSMutableStyleDeclaration.cpp:
        (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
        (WebCore::CSSMutableStyleDeclaration::copy):
        * css/CSSMutableStyleDeclaration.h:
        (WebCore::CSSMutableStyleDeclaration::create):
        (WebCore::CSSMutableStyleDeclaration::hasVariableDependentValue):
        * css/CSSParser.cpp:
        (WebCore::equal):
        (WebCore::equalIgnoringCase):
        (WebCore::CSSParser::~CSSParser):
        (WebCore::CSSParserString::lower):
        (WebCore::CSSParser::document):
        (WebCore::CSSParser::validUnit):
        (WebCore::unitFromString):
        (WebCore::CSSParser::checkForOrphanedUnits):
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parseFillShorthand):
        (WebCore::CSSParser::parseTransitionShorthand):
        (WebCore::CSSParser::parseContent):
        (WebCore::CSSParser::parseFillImage):
        (WebCore::CSSParser::parseFillPosition):
        (WebCore::CSSParser::parseFillSize):
        (WebCore::CSSParser::parseFillProperty):
        (WebCore::CSSParser::parseTransitionDuration):
        (WebCore::CSSParser::parseTransitionRepeatCount):
        (WebCore::CSSParser::parseTimingFunctionValue):
        (WebCore::CSSParser::parseTransitionTimingFunction):
        (WebCore::CSSParser::parseTransitionProperty):
        (WebCore::skipCommaInDashboardRegion):
        (WebCore::CSSParser::parseDashboardRegions):
        (WebCore::CSSParser::parseCounterContent):
        (WebCore::CSSParser::parseShape):
        (WebCore::CSSParser::parseFont):
        (WebCore::CSSParser::parseFontFamily):
        (WebCore::CSSParser::parseFontFaceSrc):
        (WebCore::CSSParser::parseFontFaceUnicodeRange):
        (WebCore::CSSParser::parseColorParameters):
        (WebCore::CSSParser::parseHSLParameters):
        (WebCore::CSSParser::parseColor):
        (WebCore::CSSParser::parseColorFromValue):
        (WebCore::ShadowParseContext::commitLength):
        (WebCore::CSSParser::parseShadow):
        (WebCore::CSSParser::parseReflect):
        (WebCore::BorderImageParseContext::commitNumber):
        (WebCore::BorderImageParseContext::commitWidth):
        (WebCore::BorderImageParseContext::commitBorderImage):
        (WebCore::CSSParser::parseBorderImage):
        (WebCore::CSSParser::parseCounter):
        (WebCore::parseGradientPoint):
        (WebCore::parseGradientColorStop):
        (WebCore::CSSParser::parseGradient):
        (WebCore::CSSParser::parseCanvas):
        (WebCore::TransformOperationInfo::TransformOperationInfo):
        (WebCore::CSSParser::parseTransform):
        (WebCore::CSSParser::lex):
        (WebCore::CSSParser::text):
        (WebCore::CSSParser::createFloatingValueList):
        (WebCore::CSSParser::sinkFloatingValueList):
        (WebCore::CSSParser::createFloatingFunction):
        (WebCore::CSSParser::sinkFloatingFunction):
        (WebCore::CSSParser::sinkFloatingValue):
        (WebCore::CSSParser::createFloatingMediaQueryExp):
        (WebCore::CSSParser::createCharsetRule):
        (WebCore::CSSParser::createImportRule):
        (WebCore::CSSParser::createVariablesRule):
        (WebCore::CSSParser::addVariable):
        (WebCore::CSSParser::clearVariables):
        (WebCore::CSSParser::parseVariable):
        (WebCore::CSSParser::parsePropertyWithResolvedVariables):
        (WebCore::CSSParser::checkForVariables):
        (WebCore::CSSParser::addUnresolvedProperty):
        (WebCore::cssPropertyID):
        (WebCore::cssValueKeywordID):
        * css/CSSParser.h:
        * css/CSSParserValues.cpp: Added.
        (WebCore::CSSParserValueList::~CSSParserValueList):
        (WebCore::CSSParserValueList::addValue):
        (WebCore::CSSParserValueList::deleteValueAt):
        (WebCore::CSSParserValue::createCSSValue):
        * css/CSSParserValues.h: Added.
        (WebCore::CSSParserString::operator String):
        (WebCore::CSSParserString::operator AtomicString):
        (WebCore::CSSParserValue::):
        (WebCore::CSSParserValueList::CSSParserValueList):
        (WebCore::CSSParserValueList::size):
        (WebCore::CSSParserValueList::current):
        (WebCore::CSSParserValueList::next):
        (WebCore::CSSParserValueList::valueAt):
        (WebCore::CSSParserValueList::clear):
        (WebCore::CSSParserValueList::containsVariables):
        (WebCore::CSSParserFunction::~CSSParserFunction):
        * css/CSSPrimitiveValue.cpp:
        (WebCore::CSSPrimitiveValue::getStringValue):
        (WebCore::CSSPrimitiveValue::cssText):
        (WebCore::CSSPrimitiveValue::parserValue):
        * css/CSSPrimitiveValue.h:
        (WebCore::CSSPrimitiveValue::):
        (WebCore::CSSPrimitiveValue::setPrimitiveType):
        * css/CSSRule.h:
        (WebCore::CSSRule::):
        * css/CSSRule.idl:
        * css/CSSStyleDeclaration.cpp:
        (WebCore::CSSStyleDeclaration::copyPropertiesInSet):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::addMatchedDeclaration):
        (WebCore::CSSStyleSelector::addVariables):
        (WebCore::CSSStyleSelector::resolveVariableDependentValue):
        (WebCore::CSSRuleSet::addRulesFromSheet):
        (WebCore::CSSStyleSelector::applyDeclarations):
        * css/CSSStyleSelector.h:
        * css/CSSValue.h:
        (WebCore::CSSValue::isVariableDependentValue):
        (WebCore::CSSValue::parserValue):
        * css/CSSValueList.cpp:
        (WebCore::CSSValueList::CSSValueList):
        (WebCore::CSSValueList::createParserValueList):
        * css/CSSValueList.h:
        (WebCore::CSSValueList::createFromParserValueList):
        * css/CSSVariableDependentValue.cpp: Added.
        (WebCore::CSSVariableDependentValue::CSSVariableDependentValue):
        (WebCore::CSSVariableDependentValue::~CSSVariableDependentValue):
        (WebCore::CSSVariableDependentValue::cssText):
        * css/CSSVariableDependentValue.h: Added.
        (WebCore::CSSVariableDependentValue::create):
        (WebCore::CSSVariableDependentValue::isVariableDependentValue):
        (WebCore::CSSVariableDependentValue::valueList):
        * css/CSSVariablesDeclaration.cpp: Added.
        (WebCore::CSSVariablesDeclaration::CSSVariablesDeclaration):
        (WebCore::CSSVariablesDeclaration::~CSSVariablesDeclaration):
        (WebCore::CSSVariablesDeclaration::getVariableValue):
        (WebCore::CSSVariablesDeclaration::removeVariable):
        (WebCore::CSSVariablesDeclaration::setVariable):
        (WebCore::CSSVariablesDeclaration::addParsedVariable):
        (WebCore::CSSVariablesDeclaration::getParsedVariable):
        (WebCore::CSSVariablesDeclaration::length):
        (WebCore::CSSVariablesDeclaration::item):
        (WebCore::CSSVariablesDeclaration::parentRule):
        (WebCore::CSSVariablesDeclaration::cssText):
        * css/CSSVariablesDeclaration.h: Added.
        (WebCore::CSSVariablesDeclaration::create):
        * css/CSSVariablesRule.cpp: Added.
        (WebCore::CSSVariablesRule::CSSVariablesRule):
        (WebCore::CSSVariablesRule::~CSSVariablesRule):
        (WebCore::CSSVariablesRule::cssText):
        * css/CSSVariablesRule.h: Added.
        (WebCore::CSSVariablesRule::media):
        (WebCore::CSSVariablesRule::variables):
        (WebCore::CSSVariablesRule::type):
        (WebCore::CSSVariablesRule::isVariablesRule):
        (WebCore::CSSVariablesRule::setDeclaration):
        * css/MediaQueryExp.cpp:
        (WebCore::MediaQueryExp::MediaQueryExp):
        * css/MediaQueryExp.h:
        * css/SVGCSSParser.cpp:
        (WebCore::CSSParser::parseSVGValue):
        (WebCore::CSSParser::parseSVGStrokeDasharray):
        * css/StyleBase.h:
        (WebCore::StyleBase::isVariablesRule):
        * css/tokenizer.flex:

LayoutTests:

2008-06-19  David Hyatt  <hyatt@apple.com>

        Add layout tests for CSS variables.

        Reviewed by Beth

        * fast/css/variables: Added.
        * fast/css/variables/colors-test.html: Added.
        * fast/css/variables/font-test.html: Added.
        * fast/css/variables/image-test.html: Added.
        * fast/css/variables/import-test.html: Added.
        * fast/css/variables/invalid-variable-test.html: Added.
        * fast/css/variables/margin-test.html: Added.
        * fast/css/variables/misplaced-import-test.html: Added.
        * fast/css/variables/misplaced-variables-test.html: Added.
        * fast/css/variables/override-test.html: Added.
        * fast/css/variables/print-test.html: Added.
        * fast/css/variables/resources: Added.
        * fast/css/variables/resources/bad.css: Added.
        * fast/css/variables/resources/good.css: Added.
        * fast/css/variables/resources/listmark.gif: Added.
        * fast/css/variables/shorthand-test.html: Added.
        * fast/css/variables/single-term-test.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34666 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2dc6b70a
2008-06-19 David Hyatt <hyatt@apple.com>
Add layout tests for CSS variables.
Reviewed by Beth
* fast/css/variables: Added.
* fast/css/variables/colors-test.html: Added.
* fast/css/variables/font-test.html: Added.
* fast/css/variables/image-test.html: Added.
* fast/css/variables/import-test.html: Added.
* fast/css/variables/invalid-variable-test.html: Added.
* fast/css/variables/margin-test.html: Added.
* fast/css/variables/misplaced-import-test.html: Added.
* fast/css/variables/misplaced-variables-test.html: Added.
* fast/css/variables/override-test.html: Added.
* fast/css/variables/print-test.html: Added.
* fast/css/variables/resources: Added.
* fast/css/variables/resources/bad.css: Added.
* fast/css/variables/resources/good.css: Added.
* fast/css/variables/resources/listmark.gif: Added.
* fast/css/variables/shorthand-test.html: Added.
* fast/css/variables/single-term-test.html: Added.
2008-06-19 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
foreground: green;
background: rgb(255, 255, 255);
}
body {
color: -webkit-var(foreground);
background-color: red;
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
familyName: "Ahem";
}
div {
color: green;
font: 24px -webkit-var(familyName);
}
</style>
</head>
<body>
<p>You should see a green rectangle below. If you see individual "X" glyphs, the test has failed. (The Ahem font is required for this test.)</p>
<div>XXXXXXXXXX</div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
marker: url(resources/listmark.gif);
}
li {
list-style-type: disc;
list-style-image: -webkit-var(marker)
}
</style>
</head>
<body>
The list below should use red diamond images for bullets. If you see circular bullets, the test has failed.
<ul>
<li>One
<li>Two
<li>Three
</ul>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html style="color:red">
<head>
<style>
@import url(resources/good.css);
body {
color: -webkit-var(foreground);
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
foreground; red;
background: rgb(255, 255, 255);
}
body {
color: green;
color: -webkit-var(foreground);
background-color: red;
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
verticalMargin: 5em;
}
div.outer {
height:10em;
width:10em;
position:absolute;
}
div.bad {
position:absolute;
top:5em;
left:2em;
height:5em;
width:5em;
background-color:red;
}
div.inner {
position:relative;
margin: -webkit-var(verticalMargin) 2em;
height:5em;
width:5em;
background-color:green;
}
</style>
</head>
<body>
You should see a 5em wide green square below. There should be no red on the page.
<div class="outer">
<div class="bad"></div>
<div class="inner"></div>
</div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
foreground: green;
background: rgb(255, 255, 255);
}
@import url(resources/bad.css);
body {
color: -webkit-var(foreground);
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
body {
color: -webkit-var(foreground);
background-color: white;
background-color: -webkit-var(background);
}
@-webkit-variables {
foreground: red;
background: red;
}
body {
color: green;
}
</style>
</head>
<body>
This text should be green on a white background.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
foreground: green;
background: red;
}
@-webkit-variables {
background: white;
}
body {
color: -webkit-var(foreground);
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
foreground: green;
background: rgb(255, 255, 255);
}
@-webkit-variables print {
foreground: black;
background: red;
}
body {
color: -webkit-var(foreground);
background-color: -webkit-var(background);
}
</style>
</head>
<body>
This text should be green on a white background. There should be no red visible.
body {
background-color: red;
foreground-color: white;
}
@-webkit-variables {
foreground: green;
background: rgb(255, 255, 255);
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
borderWidth: 10px;
borderStyle: solid;
borderColor: green;
}
div {
border: 20px dotted red;
border: -webkit-var(borderWidth) -webkit-var(borderStyle) -webkit-var(borderColor);
}
</style>
</head>
<body>
<div>This block hould have a 10px solid green border.</div>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style>
@-webkit-variables {
completeBorder: 10px solid red;
}
div {
border: -webkit-var(completeBorder);
}
</style>
</head>
<body>
<div>If this div has a red border, then the test has failed.</div>
\ No newline at end of file
2008-06-19 David Hyatt <hyatt@apple.com>
Add initial support for CSS variables. Non-dynamic cases should (hopefully) all work. Things will get
confused if you use the CSS OM to remove variables/inject variables, etc. In addition no DOM APIs are
exposed yet for the new variable interfaces.
Reviewed by Beth
Added many tests to fast/css/variables/
* WebCore.xcodeproj/project.pbxproj:
* css/CSSFunctionValue.cpp: Added.
(WebCore::CSSFunctionValue::CSSFunctionValue):
(WebCore::CSSFunctionValue::~CSSFunctionValue):
(WebCore::CSSFunctionValue::cssText):
(WebCore::CSSFunctionValue::parserValue):
* css/CSSFunctionValue.h: Added.
(WebCore::CSSFunctionValue::create):
* css/CSSGrammar.y:
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
(WebCore::CSSMutableStyleDeclaration::copy):
* css/CSSMutableStyleDeclaration.h:
(WebCore::CSSMutableStyleDeclaration::create):
(WebCore::CSSMutableStyleDeclaration::hasVariableDependentValue):
* css/CSSParser.cpp:
(WebCore::equal):
(WebCore::equalIgnoringCase):
(WebCore::CSSParser::~CSSParser):
(WebCore::CSSParserString::lower):
(WebCore::CSSParser::document):
(WebCore::CSSParser::validUnit):
(WebCore::unitFromString):
(WebCore::CSSParser::checkForOrphanedUnits):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFillShorthand):
(WebCore::CSSParser::parseTransitionShorthand):
(WebCore::CSSParser::parseContent):
(WebCore::CSSParser::parseFillImage):
(WebCore::CSSParser::parseFillPosition):
(WebCore::CSSParser::parseFillSize):
(WebCore::CSSParser::parseFillProperty):
(WebCore::CSSParser::parseTransitionDuration):
(WebCore::CSSParser::parseTransitionRepeatCount):
(WebCore::CSSParser::parseTimingFunctionValue):
(WebCore::CSSParser::parseTransitionTimingFunction):
(WebCore::CSSParser::parseTransitionProperty):
(WebCore::skipCommaInDashboardRegion):
(WebCore::CSSParser::parseDashboardRegions):
(WebCore::CSSParser::parseCounterContent):
(WebCore::CSSParser::parseShape):
(WebCore::CSSParser::parseFont):
(WebCore::CSSParser::parseFontFamily):
(WebCore::CSSParser::parseFontFaceSrc):
(WebCore::CSSParser::parseFontFaceUnicodeRange):
(WebCore::CSSParser::parseColorParameters):
(WebCore::CSSParser::parseHSLParameters):
(WebCore::CSSParser::parseColor):
(WebCore::CSSParser::parseColorFromValue):
(WebCore::ShadowParseContext::commitLength):
(WebCore::CSSParser::parseShadow):
(WebCore::CSSParser::parseReflect):
(WebCore::BorderImageParseContext::commitNumber):
(WebCore::BorderImageParseContext::commitWidth):
(WebCore::BorderImageParseContext::commitBorderImage):
(WebCore::CSSParser::parseBorderImage):
(WebCore::CSSParser::parseCounter):
(WebCore::parseGradientPoint):
(WebCore::parseGradientColorStop):
(WebCore::CSSParser::parseGradient):
(WebCore::CSSParser::parseCanvas):
(WebCore::TransformOperationInfo::TransformOperationInfo):
(WebCore::CSSParser::parseTransform):
(WebCore::CSSParser::lex):
(WebCore::CSSParser::text):
(WebCore::CSSParser::createFloatingValueList):
(WebCore::CSSParser::sinkFloatingValueList):
(WebCore::CSSParser::createFloatingFunction):
(WebCore::CSSParser::sinkFloatingFunction):
(WebCore::CSSParser::sinkFloatingValue):
(WebCore::CSSParser::createFloatingMediaQueryExp):
(WebCore::CSSParser::createCharsetRule):
(WebCore::CSSParser::createImportRule):
(WebCore::CSSParser::createVariablesRule):
(WebCore::CSSParser::addVariable):
(WebCore::CSSParser::clearVariables):
(WebCore::CSSParser::parseVariable):
(WebCore::CSSParser::parsePropertyWithResolvedVariables):
(WebCore::CSSParser::checkForVariables):
(WebCore::CSSParser::addUnresolvedProperty):
(WebCore::cssPropertyID):
(WebCore::cssValueKeywordID):
* css/CSSParser.h:
* css/CSSParserValues.cpp: Added.
(WebCore::CSSParserValueList::~CSSParserValueList):
(WebCore::CSSParserValueList::addValue):
(WebCore::CSSParserValueList::deleteValueAt):
(WebCore::CSSParserValue::createCSSValue):
* css/CSSParserValues.h: Added.
(WebCore::CSSParserString::operator String):
(WebCore::CSSParserString::operator AtomicString):
(WebCore::CSSParserValue::):
(WebCore::CSSParserValueList::CSSParserValueList):
(WebCore::CSSParserValueList::size):
(WebCore::CSSParserValueList::current):
(WebCore::CSSParserValueList::next):
(WebCore::CSSParserValueList::valueAt):
(WebCore::CSSParserValueList::clear):
(WebCore::CSSParserValueList::containsVariables):
(WebCore::CSSParserFunction::~CSSParserFunction):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::getStringValue):
(WebCore::CSSPrimitiveValue::cssText):
(WebCore::CSSPrimitiveValue::parserValue):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::):
(WebCore::CSSPrimitiveValue::setPrimitiveType):
* css/CSSRule.h:
(WebCore::CSSRule::):
* css/CSSRule.idl:
* css/CSSStyleDeclaration.cpp:
(WebCore::CSSStyleDeclaration::copyPropertiesInSet):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::addMatchedDeclaration):
(WebCore::CSSStyleSelector::addVariables):
(WebCore::CSSStyleSelector::resolveVariableDependentValue):
(WebCore::CSSRuleSet::addRulesFromSheet):
(WebCore::CSSStyleSelector::applyDeclarations):
* css/CSSStyleSelector.h:
* css/CSSValue.h:
(WebCore::CSSValue::isVariableDependentValue):
(WebCore::CSSValue::parserValue):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::CSSValueList):
(WebCore::CSSValueList::createParserValueList):
* css/CSSValueList.h:
(WebCore::CSSValueList::createFromParserValueList):
* css/CSSVariableDependentValue.cpp: Added.
(WebCore::CSSVariableDependentValue::CSSVariableDependentValue):
(WebCore::CSSVariableDependentValue::~CSSVariableDependentValue):
(WebCore::CSSVariableDependentValue::cssText):
* css/CSSVariableDependentValue.h: Added.
(WebCore::CSSVariableDependentValue::create):
(WebCore::CSSVariableDependentValue::isVariableDependentValue):
(WebCore::CSSVariableDependentValue::valueList):
* css/CSSVariablesDeclaration.cpp: Added.
(WebCore::CSSVariablesDeclaration::CSSVariablesDeclaration):
(WebCore::CSSVariablesDeclaration::~CSSVariablesDeclaration):
(WebCore::CSSVariablesDeclaration::getVariableValue):
(WebCore::CSSVariablesDeclaration::removeVariable):
(WebCore::CSSVariablesDeclaration::setVariable):
(WebCore::CSSVariablesDeclaration::addParsedVariable):
(WebCore::CSSVariablesDeclaration::getParsedVariable):
(WebCore::CSSVariablesDeclaration::length):
(WebCore::CSSVariablesDeclaration::item):
(WebCore::CSSVariablesDeclaration::parentRule):
(WebCore::CSSVariablesDeclaration::cssText):
* css/CSSVariablesDeclaration.h: Added.
(WebCore::CSSVariablesDeclaration::create):
* css/CSSVariablesRule.cpp: Added.
(WebCore::CSSVariablesRule::CSSVariablesRule):
(WebCore::CSSVariablesRule::~CSSVariablesRule):
(WebCore::CSSVariablesRule::cssText):
* css/CSSVariablesRule.h: Added.
(WebCore::CSSVariablesRule::media):
(WebCore::CSSVariablesRule::variables):
(WebCore::CSSVariablesRule::type):
(WebCore::CSSVariablesRule::isVariablesRule):
(WebCore::CSSVariablesRule::setDeclaration):
* css/MediaQueryExp.cpp:
(WebCore::MediaQueryExp::MediaQueryExp):
* css/MediaQueryExp.h:
* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parseSVGValue):
(WebCore::CSSParser::parseSVGStrokeDasharray):
* css/StyleBase.h:
(WebCore::StyleBase::isVariablesRule):
* css/tokenizer.flex:
2008-06-19 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin.
This diff is collapsed.
/*
* Copyright (C) 2008 Apple Inc. 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 APPLE INC. ``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 APPLE INC. OR
* CONTRIBUTORS 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 "CSSFunctionValue.h"
#include "CSSValueList.h"
namespace WebCore {
CSSFunctionValue::CSSFunctionValue(CSSParserFunction* function)
{
m_name = function->name;
if (function->args)
m_args = CSSValueList::createFromParserValueList(function->args);
}
CSSFunctionValue::~CSSFunctionValue()
{
}
String CSSFunctionValue::cssText() const
{
String result = m_name; // Includes the '('
if (m_args)
result += m_args->cssText();
result += ")";
return result;
}
CSSParserValue CSSFunctionValue::parserValue() const
{
CSSParserValue val;
val.id = 0;
val.unit = CSSParserValue::Function;
val.function = new CSSParserFunction;
val.function->name.characters = const_cast<UChar*>(m_name.characters());
val.function->name.length = m_name.length();
val.function->args = m_args ? m_args->createParserValueList() : 0;
return val;
}
}
/*
* Copyright (C) 2008 Apple Inc. 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 APPLE INC. ``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 APPLE INC. OR
* CONTRIBUTORS 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 CSSFunctionValue_h
#define CSSFunctionValue_h
#include "CSSValue.h"
namespace WebCore {
class CSSValueList;
struct CSSParserFunction;
class CSSFunctionValue : public CSSValue {
public:
static PassRefPtr<CSSFunctionValue> create(CSSParserFunction* function)
{
return adoptRef(new CSSFunctionValue(function));
}
~CSSFunctionValue();
virtual String cssText() const;
virtual CSSParserValue parserValue() const;
private:
CSSFunctionValue(CSSParserFunction*);
String m_name;
RefPtr<CSSValueList> m_args;
};
}
#endif
......@@ -56,7 +56,7 @@ using namespace HTMLNames;
char character;
int integer;
double number;
ParseString string;
CSSParserString string;
CSSRule* rule;
CSSRuleList* ruleList;
......@@ -66,8 +66,8 @@ using namespace HTMLNames;
MediaQuery* mediaQuery;
MediaQuery::Restrictor mediaQueryRestrictor;
MediaQueryExp* mediaQueryExp;
Value value;
ValueList* valueList;
CSSParserValue value;
CSSParserValueList* valueList;
Vector<MediaQueryExp*>* mediaQueryExpList;
}