summaryrefslogtreecommitdiffstats
path: root/WebCore/css
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2010-11-18 17:33:13 -0800
committerRussell Brenner <russellbrenner@google.com>2010-12-02 13:47:21 -0800
commit6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch)
tree103a13998c33944d6ab3b8318c509a037e639460 /WebCore/css
parentbdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff)
downloadexternal_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/css')
-rw-r--r--WebCore/css/CSSBorderImageValue.h1
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp1
-rw-r--r--WebCore/css/CSSCursorImageValue.h1
-rw-r--r--WebCore/css/CSSFontFace.cpp11
-rw-r--r--WebCore/css/CSSFontFace.h12
-rw-r--r--WebCore/css/CSSFontFaceSource.cpp9
-rw-r--r--WebCore/css/CSSFontFaceSource.h1
-rw-r--r--WebCore/css/CSSFontSelector.cpp40
-rw-r--r--WebCore/css/CSSGrammar.y151
-rw-r--r--WebCore/css/CSSImageValue.h3
-rw-r--r--WebCore/css/CSSMutableStyleDeclaration.cpp17
-rw-r--r--WebCore/css/CSSMutableStyleDeclaration.h9
-rw-r--r--WebCore/css/CSSParser.cpp118
-rw-r--r--WebCore/css/CSSParser.h14
-rw-r--r--WebCore/css/CSSParserValues.cpp11
-rw-r--r--WebCore/css/CSSParserValues.h5
-rw-r--r--WebCore/css/CSSPrimitiveValue.cpp201
-rw-r--r--WebCore/css/CSSPrimitiveValue.h39
-rw-r--r--WebCore/css/CSSProperty.cpp2
-rw-r--r--WebCore/css/CSSPropertyNames.in1
-rw-r--r--WebCore/css/CSSReflectValue.h2
-rw-r--r--WebCore/css/CSSRule.h4
-rw-r--r--WebCore/css/CSSRule.idl1
-rw-r--r--WebCore/css/CSSSegmentedFontFace.cpp2
-rw-r--r--WebCore/css/CSSStyleDeclaration.cpp8
-rw-r--r--WebCore/css/CSSStyleSelector.cpp674
-rw-r--r--WebCore/css/CSSStyleSelector.h9
-rw-r--r--WebCore/css/CSSValue.h6
-rw-r--r--WebCore/css/CSSVariableDependentValue.cpp49
-rw-r--r--WebCore/css/CSSVariableDependentValue.h57
-rw-r--r--WebCore/css/CSSVariablesDeclaration.cpp175
-rw-r--r--WebCore/css/CSSVariablesDeclaration.h82
-rw-r--r--WebCore/css/CSSVariablesDeclaration.idl44
-rw-r--r--WebCore/css/CSSVariablesRule.cpp61
-rw-r--r--WebCore/css/CSSVariablesRule.h70
-rw-r--r--WebCore/css/CSSVariablesRule.idl33
-rw-r--r--WebCore/css/FontFamilyValue.h1
-rw-r--r--WebCore/css/SVGCSSStyleSelector.cpp17
-rw-r--r--WebCore/css/ShadowValue.h2
-rw-r--r--WebCore/css/StyleBase.h1
-rw-r--r--WebCore/css/StyleSheet.cpp20
-rw-r--r--WebCore/css/StyleSheet.h1
-rw-r--r--WebCore/css/WebKitCSSMatrix.cpp17
-rw-r--r--WebCore/css/WebKitCSSMatrix.h16
-rw-r--r--WebCore/css/html.css19
-rw-r--r--WebCore/css/themeQtMobile.css9
-rw-r--r--WebCore/css/tokenizer.flex5
47 files changed, 640 insertions, 1392 deletions
diff --git a/WebCore/css/CSSBorderImageValue.h b/WebCore/css/CSSBorderImageValue.h
index a17df7d..6e1b964 100644
--- a/WebCore/css/CSSBorderImageValue.h
+++ b/WebCore/css/CSSBorderImageValue.h
@@ -56,6 +56,7 @@ public:
private:
CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule);
+ virtual bool isBorderImageValue() const { return true; }
};
} // namespace WebCore
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 35a0b4a..cb5d5c2 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -1697,7 +1697,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyWebkitTransformOriginY:
case CSSPropertyWebkitTransformOriginZ:
case CSSPropertyWebkitTransition:
- case CSSPropertyWebkitVariableDeclarationBlock:
break;
#ifdef ANDROID_CSS_RING
case CSSPropertyWebkitRing:
diff --git a/WebCore/css/CSSCursorImageValue.h b/WebCore/css/CSSCursorImageValue.h
index 2a95c3a..de03eb8 100644
--- a/WebCore/css/CSSCursorImageValue.h
+++ b/WebCore/css/CSSCursorImageValue.h
@@ -50,6 +50,7 @@ public:
private:
CSSCursorImageValue(const String& url, const IntPoint& hotSpot);
+ virtual bool isCursorImageValue() const { return true; }
IntPoint m_hotSpot;
diff --git a/WebCore/css/CSSFontFace.cpp b/WebCore/css/CSSFontFace.cpp
index 70cd9bb..2c50a04 100644
--- a/WebCore/css/CSSFontFace.cpp
+++ b/WebCore/css/CSSFontFace.cpp
@@ -118,5 +118,16 @@ SimpleFontData* CSSFontFace::getFontData(const FontDescription& fontDescription,
return 0;
}
+#if ENABLE(SVG_FONTS)
+bool CSSFontFace::hasSVGFontFaceSource() const
+{
+ for (unsigned i = 0; i < m_sources.size(); i++) {
+ if (m_sources[i]->isSVGFontFaceSource())
+ return true;
+ }
+ return false;
+}
+#endif
+
}
diff --git a/WebCore/css/CSSFontFace.h b/WebCore/css/CSSFontFace.h
index 4e2fee5..55e048c 100644
--- a/WebCore/css/CSSFontFace.h
+++ b/WebCore/css/CSSFontFace.h
@@ -42,7 +42,7 @@ class SimpleFontData;
class CSSFontFace : public RefCounted<CSSFontFace> {
public:
- static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask) { return adoptRef(new CSSFontFace(traitsMask)); }
+ static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask, bool isLocalFallback = false) { return adoptRef(new CSSFontFace(traitsMask, isLocalFallback)); }
~CSSFontFace();
FontTraitsMask traitsMask() const { return m_traitsMask; }
@@ -58,6 +58,8 @@ public:
bool isLoaded() const;
bool isValid() const;
+ bool isLocalFallback() const { return m_isLocalFallback; }
+
void addSource(CSSFontFaceSource*);
void fontLoaded(CSSFontFaceSource*);
@@ -79,10 +81,15 @@ public:
UChar32 m_to;
};
+#if ENABLE(SVG_FONTS)
+ bool hasSVGFontFaceSource() const;
+#endif
+
private:
- CSSFontFace(FontTraitsMask traitsMask)
+ CSSFontFace(FontTraitsMask traitsMask, bool isLocalFallback)
: m_traitsMask(traitsMask)
, m_activeSource(0)
+ , m_isLocalFallback(isLocalFallback)
{
}
@@ -91,6 +98,7 @@ private:
HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
Vector<CSSFontFaceSource*> m_sources;
CSSFontFaceSource* m_activeSource;
+ bool m_isLocalFallback;
};
}
diff --git a/WebCore/css/CSSFontFaceSource.cpp b/WebCore/css/CSSFontFaceSource.cpp
index 4fdcc03..30a0072 100644
--- a/WebCore/css/CSSFontFaceSource.cpp
+++ b/WebCore/css/CSSFontFaceSource.cpp
@@ -115,7 +115,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
}
// See if we have a mapping in our FontData cache.
- unsigned hashKey = fontDescription.computedPixelSize() << 2 | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
+ unsigned hashKey = fontDescription.computedPixelSize() << 3 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
if (SimpleFontData* cachedData = m_fontDataTable.get(hashKey))
return cachedData;
@@ -189,4 +189,11 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri
return fontDataRawPtr;
}
+#if ENABLE(SVG_FONTS)
+bool CSSFontFaceSource::isSVGFontFaceSource() const
+{
+ return m_svgFontFaceElement || (m_font && m_font->isSVGFont());
+}
+#endif
+
}
diff --git a/WebCore/css/CSSFontFaceSource.h b/WebCore/css/CSSFontFaceSource.h
index 4ec54d6..e2057cc 100644
--- a/WebCore/css/CSSFontFaceSource.h
+++ b/WebCore/css/CSSFontFaceSource.h
@@ -65,6 +65,7 @@ public:
#if ENABLE(SVG_FONTS)
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
+ bool isSVGFontFaceSource() const;
#endif
private:
diff --git a/WebCore/css/CSSFontSelector.cpp b/WebCore/css/CSSFontSelector.cpp
index d97589d..9c9a844 100644
--- a/WebCore/css/CSSFontSelector.cpp
+++ b/WebCore/css/CSSFontSelector.cpp
@@ -224,7 +224,7 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
}
}
} else
- traitsMask |= FontVariantNormalMask;
+ traitsMask |= FontVariantMask;
// Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace.
RefPtr<CSSFontFace> fontFace;
@@ -317,13 +317,6 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
if (familyName.isEmpty())
continue;
-#if ENABLE(SVG_FONTS)
- // SVG allows several <font> elements with the same font-family, differing only
- // in ie. font-variant. Be sure to pick up the right one - in getFontData below.
- if (foundSVGFont && (traitsMask & FontVariantSmallCapsMask))
- familyName += "-webkit-svg-small-caps";
-#endif
-
Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(familyName);
if (!familyFontFaces) {
familyFontFaces = new Vector<RefPtr<CSSFontFace> >;
@@ -340,7 +333,7 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule)
m_locallyInstalledFontFaces.set(familyName, familyLocallyInstalledFaces);
for (unsigned i = 0; i < numLocallyInstalledFaces; ++i) {
- RefPtr<CSSFontFace> locallyInstalledFontFace = CSSFontFace::create(static_cast<FontTraitsMask>(locallyInstalledFontsTraitsMasks[i]));
+ RefPtr<CSSFontFace> locallyInstalledFontFace = CSSFontFace::create(static_cast<FontTraitsMask>(locallyInstalledFontsTraitsMasks[i]), true);
locallyInstalledFontFace->addSource(new CSSFontFaceSource(familyName));
ASSERT(locallyInstalledFontFace->isValid());
familyLocallyInstalledFaces->append(locallyInstalledFontFace);
@@ -408,12 +401,30 @@ static inline bool compareFontFaces(CSSFontFace* first, CSSFontFace* second)
if (firstHasDesiredVariant != secondHasDesiredVariant)
return firstHasDesiredVariant;
+ if ((desiredTraitsMaskForComparison & FontVariantSmallCapsMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
+ // Prefer a font that has indicated that it can only support small-caps to a font that claims to support
+ // all variants. The specialized font is more likely to be true small-caps and not require synthesis.
+ bool firstRequiresSmallCaps = (firstTraitsMask & FontVariantSmallCapsMask) && !(firstTraitsMask & FontVariantNormalMask);
+ bool secondRequiresSmallCaps = (secondTraitsMask & FontVariantSmallCapsMask) && !(secondTraitsMask & FontVariantNormalMask);
+ if (firstRequiresSmallCaps != secondRequiresSmallCaps)
+ return firstRequiresSmallCaps;
+ }
+
bool firstHasDesiredStyle = firstTraitsMask & desiredTraitsMaskForComparison & FontStyleMask;
bool secondHasDesiredStyle = secondTraitsMask & desiredTraitsMaskForComparison & FontStyleMask;
if (firstHasDesiredStyle != secondHasDesiredStyle)
return firstHasDesiredStyle;
+ if ((desiredTraitsMaskForComparison & FontStyleItalicMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
+ // Prefer a font that has indicated that it can only support italics to a font that claims to support
+ // all styles. The specialized font is more likely to be the one the author wants used.
+ bool firstRequiresItalics = (firstTraitsMask & FontStyleItalicMask) && !(firstTraitsMask & FontStyleNormalMask);
+ bool secondRequiresItalics = (secondTraitsMask & FontStyleItalicMask) && !(secondTraitsMask & FontStyleNormalMask);
+ if (firstRequiresItalics != secondRequiresItalics)
+ return firstRequiresItalics;
+ }
+
if (secondTraitsMask & desiredTraitsMaskForComparison & FontWeightMask)
return false;
if (firstTraitsMask & desiredTraitsMaskForComparison & FontWeightMask)
@@ -469,11 +480,6 @@ FontData* CSSFontSelector::getFontData(const FontDescription& fontDescription, c
String family = familyName.string();
-#if ENABLE(SVG_FONTS)
- if (fontDescription.smallCaps())
- family += "-webkit-svg-small-caps";
-#endif
-
Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(family);
// If no face was found, then return 0 and let the OS come up with its best match for the name.
if (!familyFontFaces || familyFontFaces->isEmpty()) {
@@ -504,6 +510,12 @@ FontData* CSSFontSelector::getFontData(const FontDescription& fontDescription, c
continue;
if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
continue;
+#if ENABLE(SVG_FONTS)
+ // For SVG Fonts that specify that they only support the "normal" variant, we will assume they are incapable
+ // of small-caps synthesis and just ignore the font face as a candidate.
+ if (candidate->hasSVGFontFaceSource() && (traitsMask & FontVariantSmallCapsMask) && !(candidateTraitsMask & FontVariantSmallCapsMask))
+ continue;
+#endif
candidateFontFaces.append(candidate);
}
diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y
index c0139a2..5c77340 100644
--- a/WebCore/css/CSSGrammar.y
+++ b/WebCore/css/CSSGrammar.y
@@ -99,7 +99,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%}
-%expect 56
+%expect 51
%nonassoc LOWEST_PREC
@@ -140,10 +140,6 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%token WEBKIT_VALUE_SYM
%token WEBKIT_MEDIAQUERY_SYM
%token WEBKIT_SELECTOR_SYM
-%token WEBKIT_VARIABLES_SYM
-%token WEBKIT_DEFINE_SYM
-%token VARIABLES_FOR
-%token WEBKIT_VARIABLES_DECLS_SYM
%token <marginBox> TOPLEFTCORNER_SYM
%token <marginBox> TOPLEFT_SYM
%token <marginBox> TOPCENTER_SYM
@@ -197,8 +193,6 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%token <string> UNICODERANGE
-%token <string> VARCALL
-
%type <relation> combinator
%type <rule> charset
@@ -219,8 +213,6 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%type <ruleList> block_rule_list
%type <rule> block_rule
%type <rule> block_valid_rule
-%type <rule> variables_rule
-%type <mediaList> variables_media_list
%type <string> maybe_ns_prefix
@@ -282,12 +274,6 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%type <string> element_name
%type <string> attr_name
-%type <string> variable_name
-%type <boolean> variables_declaration_list
-%type <boolean> variables_decl_list
-%type <boolean> variables_declaration
-%type <value> variable_reference
-
%%
stylesheet:
@@ -297,7 +283,6 @@ stylesheet:
| webkit_value maybe_space
| webkit_mediaquery maybe_space
| webkit_selector maybe_space
- | webkit_variables_decls maybe_space
| webkit_keyframe_rule maybe_space
;
@@ -319,12 +304,6 @@ webkit_decls:
}
;
-webkit_variables_decls:
- WEBKIT_VARIABLES_DECLS_SYM '{' maybe_space variables_declaration_list '}' {
- /* can be empty */
- }
-;
-
webkit_value:
WEBKIT_VALUE_SYM '{' maybe_space expr '}' {
CSSParser* p = static_cast<CSSParser*>(parser);
@@ -417,7 +396,6 @@ valid_rule:
| keyframes
| namespace
| import
- | variables_rule
;
rule:
@@ -454,7 +432,6 @@ block_rule:
| invalid_at
| namespace
| import
- | variables_rule
| media
;
@@ -474,109 +451,6 @@ import:
}
;
-variables_rule:
- WEBKIT_VARIABLES_SYM maybe_space maybe_media_list '{' maybe_space variables_declaration_list '}' {
- $$ = static_cast<CSSParser*>(parser)->createVariablesRule($3, true);
- }
- |
- WEBKIT_DEFINE_SYM maybe_space variables_media_list '{' maybe_space variables_declaration_list '}' {
- $$ = static_cast<CSSParser*>(parser)->createVariablesRule($3, false);
- }
- ;
-
-variables_media_list:
- /* empty */ {
- $$ = static_cast<CSSParser*>(parser)->createMediaList();
- }
- |
- VARIABLES_FOR WHITESPACE media_list {
- $$ = $3;
- }
- ;
-
-variables_declaration_list:
- variables_declaration {
- $$ = $1;
- }
- | variables_decl_list variables_declaration {
- $$ = $1;
- if ($2)
- $$ = $2;
- }
- | variables_decl_list {
- $$ = $1;
- }
- | error invalid_block_list error {
- $$ = false;
- }
- | error {
- $$ = false;
- }
- | variables_decl_list error {
- $$ = $1;
- }
- ;
-
-variables_decl_list:
- variables_declaration ';' maybe_space {
- $$ = $1;
- }
- | variables_declaration invalid_block_list ';' maybe_space {
- $$ = false;
- }
- | error ';' maybe_space {
- $$ = false;
- }
- | error invalid_block_list error ';' maybe_space {
- $$ = false;
- }
- | variables_decl_list variables_declaration ';' maybe_space {
- $$ = $1;
- if ($2)
- $$ = $2;
- }
- | variables_decl_list error ';' maybe_space {
- $$ = $1;
- }
- | variables_decl_list error invalid_block_list error ';' maybe_space {
- $$ = $1;
- }
- ;
-
-variables_declaration:
- variable_name ':' maybe_space expr {
- $$ = static_cast<CSSParser*>(parser)->addVariable($1, $4);
- }
- |
- variable_name maybe_space '{' maybe_space declaration_list '}' maybe_space {
- $$ = static_cast<CSSParser*>(parser)->addVariableDeclarationBlock($1);
- }
- |
- variable_name error {
- $$ = false;
- }
- |
- variable_name ':' maybe_space error expr {
- $$ = false;
- }
- |
- variable_name ':' maybe_space {
- /* @variables { varname: } Just reduce away this variable with no value. */
- $$ = false;
- }
- |
- variable_name ':' maybe_space error {
- /* if we come across rules with invalid values like this case: @variables { varname: *; }, just discard the property/value pair */
- $$ = false;
- }
- ;
-
-variable_name:
- IDENT maybe_space {
- $$ = $1;
- }
- ;
-
namespace:
NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' {
static_cast<CSSParser*>(parser)->addNamespace($3, $4);
@@ -1432,18 +1306,6 @@ declaration:
p->markPropertyEnd($5, isPropertyParsed);
}
|
- variable_reference maybe_space {
- CSSParser* p = static_cast<CSSParser*>(parser);
- p->m_valueList = new CSSParserValueList;
- p->m_valueList->addValue(p->sinkFloatingValue($1));
- int oldParsedProperties = p->m_numParsedProperties;
- $$ = p->parseValue(CSSPropertyWebkitVariableDeclarationBlock, false);
- if (!$$)
- p->rollbackLastProperties(p->m_numParsedProperties - oldParsedProperties);
- delete p->m_valueList;
- p->m_valueList = 0;
- }
- |
property error {
$$ = false;
}
@@ -1563,9 +1425,6 @@ term:
| function {
$$ = $1;
}
- | variable_reference maybe_space {
- $$ = $1;
- }
| '%' maybe_space { /* Handle width: %; */
$$.id = 0; $$.unit = 0;
}
@@ -1602,14 +1461,6 @@ unary_term:
}
;
-variable_reference:
- VARCALL {
- $$.id = 0;
- $$.string = $1;
- $$.unit = CSSPrimitiveValue::CSS_PARSER_VARIABLE_FUNCTION_SYNTAX;
- }
- ;
-
function:
FUNCTION maybe_space expr ')' maybe_space {
CSSParser* p = static_cast<CSSParser*>(parser);
diff --git a/WebCore/css/CSSImageValue.h b/WebCore/css/CSSImageValue.h
index a9c8c9b..833d7fe 100644
--- a/WebCore/css/CSSImageValue.h
+++ b/WebCore/css/CSSImageValue.h
@@ -41,8 +41,6 @@ public:
// Returns a StyleCachedImage if the image is cached already, otherwise a StylePendingImage.
StyleImage* cachedOrPendingImage();
- virtual bool isImageValue() const { return true; }
-
protected:
CSSImageValue(const String& url);
@@ -52,6 +50,7 @@ protected:
private:
CSSImageValue();
+ virtual bool isImageValue() const { return true; }
RefPtr<StyleImage> m_image;
bool m_accessedImage;
diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp
index 38aee50..774a8eb 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.cpp
+++ b/WebCore/css/CSSMutableStyleDeclaration.cpp
@@ -39,7 +39,6 @@ namespace WebCore {
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
: m_node(0)
- , m_variableDependentValueCount(0)
, m_strictParsing(false)
#ifndef NDEBUG
, m_iteratorCount(0)
@@ -50,7 +49,6 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent)
: CSSStyleDeclaration(parent)
, m_node(0)
- , m_variableDependentValueCount(0)
, m_strictParsing(!parent || parent->useStrictParsing())
#ifndef NDEBUG
, m_iteratorCount(0)
@@ -58,11 +56,10 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent)
{
}
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Vector<CSSProperty>& properties, unsigned variableDependentValueCount)
+CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Vector<CSSProperty>& properties)
: CSSStyleDeclaration(parent)
, m_properties(properties)
, m_node(0)
- , m_variableDependentValueCount(variableDependentValueCount)
, m_strictParsing(!parent || parent->useStrictParsing())
#ifndef NDEBUG
, m_iteratorCount(0)
@@ -75,7 +72,6 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Ve
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties)
: CSSStyleDeclaration(parent)
, m_node(0)
- , m_variableDependentValueCount(0)
, m_strictParsing(!parent || parent->useStrictParsing())
#ifndef NDEBUG
, m_iteratorCount(0)
@@ -86,9 +82,7 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS
for (int i = 0; i < numProperties; ++i) {
const CSSProperty *property = properties[i];
ASSERT(property);
- if (property->value()->isVariableDependentValue())
- m_variableDependentValueCount++;
- else if (candidates.contains(property->id()))
+ if (candidates.contains(property->id()))
removeProperty(properties[i]->id(), false);
m_properties.append(*property);
if (!getPropertyPriority(property->id()) && !property->isImportant())
@@ -471,9 +465,6 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha
String value = returnText ? foundProperty->value()->cssText() : String();
- if (foundProperty->value()->isVariableDependentValue())
- m_variableDependentValueCount--;
-
// A more efficient removal strategy would involve marking entries as empty
// and sweeping them when the vector grows too big.
m_properties.remove(foundProperty - m_properties.data());
@@ -623,8 +614,6 @@ void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* p
removeProperty(properties[i]->id(), false);
ASSERT(properties[i]);
m_properties.append(*properties[i]);
- if (properties[i]->value()->isVariableDependentValue())
- m_variableDependentValueCount++;
}
}
// FIXME: This probably should have a call to setNeedsStyleRecalc() if something changed. We may also wish to add
@@ -835,7 +824,7 @@ PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::makeMutable()
PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copy() const
{
- return adoptRef(new CSSMutableStyleDeclaration(0, m_properties, m_variableDependentValueCount));
+ return adoptRef(new CSSMutableStyleDeclaration(0, m_properties));
}
const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) const
diff --git a/WebCore/css/CSSMutableStyleDeclaration.h b/WebCore/css/CSSMutableStyleDeclaration.h
index d629bcf..72536b6 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.h
+++ b/WebCore/css/CSSMutableStyleDeclaration.h
@@ -69,9 +69,9 @@ public:
{
return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties));
}
- static PassRefPtr<CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties, unsigned variableDependentValueCount)
+ static PassRefPtr<CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties)
{
- return adoptRef(new CSSMutableStyleDeclaration(0, properties, variableDependentValueCount));
+ return adoptRef(new CSSMutableStyleDeclaration(0, properties));
}
CSSMutableStyleDeclaration& operator=(const CSSMutableStyleDeclaration&);
@@ -131,8 +131,6 @@ public:
void merge(CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);
- bool hasVariableDependentValue() const { return m_variableDependentValueCount > 0; }
-
void setStrictParsing(bool b) { m_strictParsing = b; }
bool useStrictParsing() const { return m_strictParsing; }
@@ -143,7 +141,7 @@ protected:
private:
CSSMutableStyleDeclaration();
- CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&, unsigned variableDependentValueCount);
+ CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&);
CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties);
virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
@@ -164,7 +162,6 @@ private:
Vector<CSSProperty, 4> m_properties;
Node* m_node;
- unsigned m_variableDependentValueCount : 24;
bool m_strictParsing : 1;
#ifndef NDEBUG
unsigned m_iteratorCount : 4;
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index dcff1ac..df222b9 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -53,9 +53,6 @@
#include "CSSUnicodeRangeValue.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
-#include "CSSVariableDependentValue.h"
-#include "CSSVariablesDeclaration.h"
-#include "CSSVariablesRule.h"
#include "Counter.h"
#include "Document.h"
#include "FloatConversion.h"
@@ -158,7 +155,6 @@ CSSParser::CSSParser(bool strictParsing)
, m_lineNumber(0)
, m_lastSelectorLineNumber(0)
, m_allowImportRules(true)
- , m_allowVariablesRules(true)
, m_allowNamespaceDeclarations(true)
{
#if YYDEBUG > 0
@@ -172,8 +168,6 @@ CSSParser::~CSSParser()
clearProperties();
fastFree(m_parsedProperties);
- clearVariables();
-
delete m_valueList;
fastFree(m_data);
@@ -369,9 +363,15 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
cssyyparse(this);
m_selectorListForParseSelector = 0;
+<<<<<<< HEAD
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
#endif
+=======
+
+ // The style sheet will be deleted right away, so it won't outlive the document.
+ ASSERT(dummyStyleSheet->hasOneRef());
+>>>>>>> webkit.org at r72274
}
bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData)
@@ -648,14 +648,6 @@ bool CSSParser::parseValue(int propId, bool important)
return true;
}
- // If we have any variables, then we don't parse the list of values yet. We add them to the declaration
- // as unresolved, and allow them to be parsed later. The parse is considered "successful" for now, even though
- // it might ultimately fail once the variable has been resolved.
- if (!inShorthand() && checkForVariables(m_valueList)) {
- addUnresolvedProperty(propId, important);
- return true;
- }
-
bool validPrimitive = false;
RefPtr<CSSValue> parsedValue;
@@ -1822,7 +1814,6 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyTextLineThrough:
case CSSPropertyTextOverline:
case CSSPropertyTextUnderline:
- case CSSPropertyWebkitVariableDeclarationBlock:
return false;
#if ENABLE(WCSS)
@@ -2454,7 +2445,19 @@ bool CSSParser::parseContent(int propId, bool important)
// close-quote
// no-open-quote
// no-close-quote
+ // inherit
// FIXME: These are not yet implemented (http://bugs.webkit.org/show_bug.cgi?id=6503).
+ // none
+ // normal
+ switch (val->id) {
+ case CSSValueOpenQuote:
+ case CSSValueCloseQuote:
+ case CSSValueNoOpenQuote:
+ case CSSValueNoCloseQuote:
+ case CSSValueNone:
+ case CSSValueNormal:
+ parsedValue = CSSPrimitiveValue::createIdentifier(val->id);
+ }
} else if (val->unit == CSSPrimitiveValue::CSS_STRING) {
parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::CSS_STRING);
}
@@ -5195,7 +5198,6 @@ int CSSParser::lex(void* yylvalWithoutType)
case UNICODERANGE:
case FUNCTION:
case NOTFUNCTION:
- case VARCALL:
yylval->string.characters = t;
yylval->string.length = length;
break;
@@ -5266,7 +5268,6 @@ void CSSParser::recheckAtKeyword(const UChar* str, int len)
yyTok = WEBKIT_KEYFRAMES_SYM;
else if (equalIgnoringCase(ruleName, "@-webkit-mediaquery"))
yyTok = WEBKIT_MEDIAQUERY_SYM;
- // FIXME: Add CSS Variables if we ever decide to turn it back on.
}
UChar* CSSParser::text(int *length)
@@ -5301,19 +5302,6 @@ UChar* CSSParser::text(int *length)
l -= 2;
}
break;
- case VARCALL:
- // "-webkit-var("{w}{ident}{w}")"
- // strip "-webkit-var(" and ")"
- start += 12;
- l -= 13;
- // strip {w}
- while (l && isHTMLSpace(*start)) {
- ++start;
- --l;
- }
- while (l && isHTMLSpace(start[l - 1]))
- --l;
- break;
default:
break;
}
@@ -5536,7 +5524,7 @@ CSSRule* CSSParser::createMediaRule(MediaList* media, CSSRuleList* rules)
{
if (!media || !rules || !m_styleSheet)
return 0;
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<CSSMediaRule> rule = CSSMediaRule::create(m_styleSheet, media, rules);
CSSMediaRule* result = rule.get();
m_parsedStyleObjects.append(rule.release());
@@ -5554,7 +5542,7 @@ CSSRuleList* CSSParser::createRuleList()
WebKitCSSKeyframesRule* CSSParser::createKeyframesRule()
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<WebKitCSSKeyframesRule> rule = WebKitCSSKeyframesRule::create(m_styleSheet);
WebKitCSSKeyframesRule* rulePtr = rule.get();
m_parsedStyleObjects.append(rule.release());
@@ -5563,7 +5551,7 @@ WebKitCSSKeyframesRule* CSSParser::createKeyframesRule()
CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
CSSStyleRule* result = 0;
markRuleBodyEnd();
if (selectors) {
@@ -5591,7 +5579,7 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
CSSRule* CSSParser::createFontFaceRule()
{
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet);
for (unsigned i = 0; i < m_numParsedProperties; ++i) {
CSSProperty* property = m_parsedProperties[i];
@@ -5614,70 +5602,13 @@ void CSSParser::addNamespace(const AtomicString& prefix, const AtomicString& uri
if (!m_styleSheet || !m_allowNamespaceDeclarations)
return;
m_allowImportRules = false;
- m_allowVariablesRules = false;
m_styleSheet->addNamespace(this, prefix, uri);
}
-#if !ENABLE(CSS_VARIABLES)
-
-CSSRule* CSSParser::createVariablesRule(MediaList*, bool)
-{
- return 0;
-}
-
-bool CSSParser::addVariable(const CSSParserString&, CSSParserValueList*)
-{
- return false;
-}
-
-bool CSSParser::addVariableDeclarationBlock(const CSSParserString&)
-{
- return false;
-}
-
-#else
-
-CSSRule* CSSParser::createVariablesRule(MediaList* mediaList, bool variablesKeyword)
-{
- if (!m_allowVariablesRules)
- return 0;
- m_allowImportRules = false;
- RefPtr<CSSVariablesRule> rule = CSSVariablesRule::create(m_styleSheet, mediaList, variablesKeyword);
- rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues));
- clearVariables();
- CSSRule* result = rule.get();
- m_parsedStyleObjects.append(rule.release());
- return result;
-}
-
-bool CSSParser::addVariable(const CSSParserString& name, CSSParserValueList* valueList)
-{
- if (checkForVariables(valueList)) {
- delete valueList;
- return false;
- }
- m_variableNames.append(String(name));
- m_variableValues.append(CSSValueList::createFromParserValueList(valueList));
- return true;
-}
-
-bool CSSParser::addVariableDeclarationBlock(const CSSParserString&)
-{
-// FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues.
-#if 0
- m_variableNames.append(String(name));
- m_variableValues.append(CSSMutableStyleDeclaration::create(0, m_parsedProperties, m_numParsedProperties));
- clearProperties();
-#endif
- return true;
-}
-
-#endif
-
CSSRule* CSSParser::createPageRule(CSSSelector* pageSelector)
{
// FIXME: Margin at-rules are ignored.
- m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false;
+ m_allowImportRules = m_allowNamespaceDeclarations = false;
CSSPageRule* pageRule = 0;
if (pageSelector) {
RefPtr<CSSPageRule> rule = CSSPageRule::create(m_styleSheet, pageSelector, m_lastSelectorLineNumber);
@@ -5712,6 +5643,7 @@ void CSSParser::endDeclarationsForMarginBox()
m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
}
+<<<<<<< HEAD
void CSSParser::clearVariables()
{
m_variableNames.clear();
@@ -5785,6 +5717,8 @@ void CSSParser::addUnresolvedProperty(int propId, bool important)
addProperty(propId, val.release(), important);
}
+=======
+>>>>>>> webkit.org at r72274
void CSSParser::deleteFontFaceOnlyValues()
{
ASSERT(m_hasFontFaceOnlyValues);
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index 8f3c6dd..1da20b7 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -45,7 +45,6 @@ namespace WebCore {
class CSSStyleSheet;
class CSSValue;
class CSSValueList;
- class CSSVariablesDeclaration;
class Document;
class MediaList;
class MediaQueryExp;
@@ -161,8 +160,6 @@ namespace WebCore {
PassRefPtr<CSSValueList> parseTransform();
bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
bool parsePerspectiveOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- bool parseVariable(CSSVariablesDeclaration*, const String& variableName, const String& variableValue);
- void parsePropertyWithResolvedVariables(int propId, bool important, CSSMutableStyleDeclaration*, CSSParserValueList*);
int yyparse();
@@ -186,7 +183,6 @@ namespace WebCore {
CSSRuleList* createRuleList();
CSSRule* createStyleRule(Vector<CSSSelector*>* selectors);
CSSRule* createFontFaceRule();
- CSSRule* createVariablesRule(MediaList*, bool variablesKeyword);
CSSRule* createPageRule(CSSSelector* pageSelector);
CSSRule* createMarginAtRule(CSSSelector::MarginBoxType marginBox);
void startDeclarationsForMarginBox();
@@ -202,10 +198,6 @@ namespace WebCore {
void addNamespace(const AtomicString& prefix, const AtomicString& uri);
- bool addVariable(const CSSParserString&, CSSParserValueList*);
- bool addVariableDeclarationBlock(const CSSParserString&);
- bool checkForVariables(CSSParserValueList*);
- void addUnresolvedProperty(int propId, bool important);
void invalidBlockHit();
Vector<CSSSelector*>* reusableSelectorVector() { return &m_reusableSelectorVector; }
@@ -235,9 +227,6 @@ namespace WebCore {
bool m_hasFontFaceOnlyValues;
bool m_hadSyntacticallyValidCSSRule;
- Vector<String> m_variableNames;
- Vector<RefPtr<CSSValue> > m_variableValues;
-
AtomicString m_defaultNamespace;
// tokenizer methods and data
@@ -270,8 +259,6 @@ namespace WebCore {
void checkForOrphanedUnits();
- void clearVariables();
-
void deleteFontFaceOnlyValues();
enum SizeParameterType {
@@ -299,7 +286,6 @@ namespace WebCore {
int m_lastSelectorLineNumber;
bool m_allowImportRules;
- bool m_allowVariablesRules;
bool m_allowNamespaceDeclarations;
Vector<RefPtr<StyleBase> > m_parsedStyleObjects;
diff --git a/WebCore/css/CSSParserValues.cpp b/WebCore/css/CSSParserValues.cpp
index 55ecb7f..06651f1 100644
--- a/WebCore/css/CSSParserValues.cpp
+++ b/WebCore/css/CSSParserValues.cpp
@@ -26,11 +26,6 @@
namespace WebCore {
-bool CSSParserValue::isVariable() const
-{
- return unit == CSSPrimitiveValue::CSS_PARSER_VARIABLE_FUNCTION_SYNTAX;
-}
-
CSSParserValueList::~CSSParserValueList()
{
size_t numValues = m_values.size();
@@ -42,15 +37,11 @@ CSSParserValueList::~CSSParserValueList()
void CSSParserValueList::addValue(const CSSParserValue& v)
{
- if (v.unit == CSSPrimitiveValue::CSS_PARSER_VARIABLE_FUNCTION_SYNTAX) // isVariable() is not inlined. This is hot.
- m_variablesCount++;
m_values.append(v);
}
void CSSParserValueList::deleteValueAt(unsigned i)
{
- if (m_values[i].isVariable())
- m_variablesCount--;
m_values.remove(i);
}
@@ -69,7 +60,7 @@ PassRefPtr<CSSValue> CSSParserValue::createCSSValue()
parsedValue = primitiveValue;
} else if (unit == CSSParserValue::Function)
parsedValue = CSSFunctionValue::create(function);
- else if (unit == CSSPrimitiveValue::CSS_STRING || unit == CSSPrimitiveValue::CSS_URI || unit == CSSPrimitiveValue::CSS_PARSER_HEXCOLOR || isVariable())
+ else if (unit == CSSPrimitiveValue::CSS_STRING || unit == CSSPrimitiveValue::CSS_URI || unit == CSSPrimitiveValue::CSS_PARSER_HEXCOLOR)
parsedValue = CSSPrimitiveValue::create(string, (CSSPrimitiveValue::UnitTypes)unit);
else if (unit >= CSSPrimitiveValue::CSS_NUMBER && unit <= CSSPrimitiveValue::CSS_KHZ)
parsedValue = CSSPrimitiveValue::create(fValue, (CSSPrimitiveValue::UnitTypes)unit);
diff --git a/WebCore/css/CSSParserValues.h b/WebCore/css/CSSParserValues.h
index 8644d9b..993ae28 100644
--- a/WebCore/css/CSSParserValues.h
+++ b/WebCore/css/CSSParserValues.h
@@ -55,7 +55,6 @@ struct CSSParserValue {
};
int unit;
- bool isVariable() const;
PassRefPtr<CSSValue> createCSSValue();
};
@@ -64,7 +63,6 @@ class CSSParserValueList : public FastAllocBase {
public:
CSSParserValueList()
: m_current(0)
- , m_variablesCount(0)
{
}
~CSSParserValueList();
@@ -80,11 +78,8 @@ public:
void clear() { m_values.clear(); }
- bool containsVariables() const { return m_variablesCount; }
-
private:
unsigned m_current;
- unsigned m_variablesCount;
Vector<CSSParserValue, 4> m_values;
};
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index 065c244..ce1b87b 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -36,6 +36,7 @@
#include "RenderStyle.h"
#include <wtf/ASCIICType.h>
#include <wtf/DecimalNumber.h>
+#include <wtf/MathExtras.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringBuffer.h>
@@ -47,6 +48,38 @@ using namespace WTF;
namespace WebCore {
+static CSSPrimitiveValue::UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes type)
+{
+ // Here we violate the spec (http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSPrimitiveValue) and allow conversions
+ // between CSS_PX and relative lengths (see cssPixelsPerInch comment in CSSHelper.h for the topic treatment).
+ switch (type) {
+ case CSSPrimitiveValue::CSS_NUMBER:
+ return CSSPrimitiveValue::UNumber;
+ case CSSPrimitiveValue::CSS_PERCENTAGE:
+ return CSSPrimitiveValue::UPercent;
+ case CSSPrimitiveValue::CSS_PX:
+ case CSSPrimitiveValue::CSS_CM:
+ case CSSPrimitiveValue::CSS_MM:
+ case CSSPrimitiveValue::CSS_IN:
+ case CSSPrimitiveValue::CSS_PT:
+ case CSSPrimitiveValue::CSS_PC:
+ return CSSPrimitiveValue::ULength;
+ case CSSPrimitiveValue::CSS_MS:
+ case CSSPrimitiveValue::CSS_S:
+ return CSSPrimitiveValue::UTime;
+ case CSSPrimitiveValue::CSS_DEG:
+ case CSSPrimitiveValue::CSS_RAD:
+ case CSSPrimitiveValue::CSS_GRAD:
+ case CSSPrimitiveValue::CSS_TURN:
+ return CSSPrimitiveValue::UAngle;
+ case CSSPrimitiveValue::CSS_HZ:
+ case CSSPrimitiveValue::CSS_KHZ:
+ return CSSPrimitiveValue::UFrequency;
+ default:
+ return CSSPrimitiveValue::UOther;
+ }
+}
+
typedef HashMap<const CSSPrimitiveValue*, String> CSSTextCache;
static CSSTextCache& cssTextCache()
{
@@ -55,7 +88,7 @@ static CSSTextCache& cssTextCache()
}
// A more stylish solution than sharing would be to turn CSSPrimitiveValue (or CSSValues in general) into non-virtual,
-// non-refcounted simple type with value semantics. In practice these sharing tricks get similar memory benefits
+// non-refcounted simple type with value semantics. In practice these sharing tricks get similar memory benefits
// with less need for refactoring.
inline PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createUncachedIdentifier(int identifier)
@@ -274,7 +307,6 @@ void CSSPrimitiveValue::cleanup()
case CSS_STRING:
case CSS_URI:
case CSS_ATTR:
- case CSS_PARSER_VARIABLE_FUNCTION_SYNTAX:
case CSS_PARSER_HEXCOLOR:
if (m_value.string)
m_value.string->deref();
@@ -408,26 +440,24 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r
return zoomedResult;
}
-void CSSPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue, ExceptionCode& ec)
+void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionCode& ec)
{
- ec = 0;
-
- if (m_type < CSS_NUMBER || m_type > CSS_DIMENSION || unitType < CSS_NUMBER || unitType > CSS_DIMENSION) {
- ec = INVALID_ACCESS_ERR;
- return;
- }
-
- cleanup();
-
- m_value.num = floatValue;
- m_type = unitType;
+ // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
+ // No other engine supports mutating style through this API. Computed style is always read-only anyway.
+ // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
+ ec = NO_MODIFICATION_ALLOWED_ERR;
}
-static double scaleFactorForConversion(unsigned short unitType)
+static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
{
double factor = 1.0;
+ // FIXME: the switch can be replaced by an array of scale factors.
switch (unitType) {
+ // These are "canonical" units in their respective categories.
case CSSPrimitiveValue::CSS_PX:
+ case CSSPrimitiveValue::CSS_DEG:
+ case CSSPrimitiveValue::CSS_MS:
+ case CSSPrimitiveValue::CSS_HZ:
break;
case CSSPrimitiveValue::CSS_CM:
factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
@@ -444,6 +474,19 @@ static double scaleFactorForConversion(unsigned short unitType)
case CSSPrimitiveValue::CSS_PC:
factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
break;
+ case CSSPrimitiveValue::CSS_RAD:
+ factor = 180 / piDouble;
+ break;
+ case CSSPrimitiveValue::CSS_GRAD:
+ factor = 0.9;
+ break;
+ case CSSPrimitiveValue::CSS_TURN:
+ factor = 360;
+ break;
+ case CSSPrimitiveValue::CSS_S:
+ case CSSPrimitiveValue::CSS_KHZ:
+ factor = 1000;
+ break;
default:
break;
}
@@ -451,69 +494,103 @@ static double scaleFactorForConversion(unsigned short unitType)
return factor;
}
-double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionCode& ec)
+double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionCode& ec) const
{
- ec = 0;
- if (m_type < CSS_NUMBER || m_type > CSS_DIMENSION || unitType < CSS_NUMBER || unitType > CSS_DIMENSION) {
+ double result = 0;
+ bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &result);
+ if (!success) {
ec = INVALID_ACCESS_ERR;
return 0.0;
}
- if (unitType == m_type || unitType < CSS_PX || unitType > CSS_PC)
- return m_value.num;
+ ec = 0;
+ return result;
+}
+
+double CSSPrimitiveValue::getDoubleValue(unsigned short unitType) const
+{
+ double result = 0;
+ getDoubleValueInternal(static_cast<UnitTypes>(unitType), &result);
+ return result;
+}
+
+CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::canonicalUnitTypeForCategory(UnitCategory category)
+{
+ // The canonical unit type is chosen according to the way CSSParser::validUnit() chooses the default unit
+ // in each category (based on unitflags).
+ switch (category) {
+ case UNumber:
+ return CSS_NUMBER;
+ case ULength:
+ return CSS_PX;
+ case UPercent:
+ return CSS_UNKNOWN; // Cannot convert between numbers and percent.
+ case UTime:
+ return CSS_MS;
+ case UAngle:
+ return CSS_DEG;
+ case UFrequency:
+ return CSS_HZ;
+ default:
+ return CSS_UNKNOWN;
+ }
+}
- double convertedValue = m_value.num;
+bool CSSPrimitiveValue::getDoubleValueInternal(UnitTypes requestedUnitType, double* result) const
+{
+ if (m_type < CSS_NUMBER || (m_type > CSS_DIMENSION && m_type < CSS_TURN) || requestedUnitType < CSS_NUMBER || (requestedUnitType > CSS_DIMENSION && requestedUnitType < CSS_TURN))
+ return false;
+ if (requestedUnitType == m_type || requestedUnitType == CSS_DIMENSION) {
+ *result = m_value.num;
+ return true;
+ }
- // First convert the value from m_type into CSSPixels
- double factor = scaleFactorForConversion(m_type);
- convertedValue *= factor;
+ UnitTypes sourceUnitType = static_cast<UnitTypes>(m_type);
+ UnitCategory sourceCategory = unitCategory(sourceUnitType);
+ ASSERT(sourceCategory != UOther);
- // Now convert from CSSPixels to the specified unitType
- factor = scaleFactorForConversion(unitType);
- convertedValue /= factor;
+ UnitTypes targetUnitType = requestedUnitType;
+ UnitCategory targetCategory = unitCategory(targetUnitType);
+ ASSERT(targetCategory != UOther);
- return convertedValue;
-}
+ // Cannot convert between unrelated unit categories if one of them is not UNumber.
+ if (sourceCategory != targetCategory && sourceCategory != UNumber && targetCategory != UNumber)
+ return false;
-double CSSPrimitiveValue::getDoubleValue(unsigned short unitType)
-{
- if (m_type < CSS_NUMBER || m_type > CSS_DIMENSION || unitType < CSS_NUMBER || unitType > CSS_DIMENSION)
- return 0;
+ if (targetCategory == UNumber) {
+ // We interpret conversion to CSS_NUMBER as conversion to a canonical unit in this value's category.
+ targetUnitType = canonicalUnitTypeForCategory(sourceCategory);
+ if (targetUnitType == CSS_UNKNOWN)
+ return false;
+ }
- if (unitType == m_type || unitType < CSS_PX || unitType > CSS_PC)
- return m_value.num;
+ if (sourceUnitType == CSS_NUMBER) {
+ // We interpret conversion from CSS_NUMBER in the same way as CSSParser::validUnit() while using non-strict mode.
+ sourceUnitType = canonicalUnitTypeForCategory(targetCategory);
+ if (sourceUnitType == CSS_UNKNOWN)
+ return false;
+ }
double convertedValue = m_value.num;
- // First convert the value from m_type into CSSPixels
- double factor = scaleFactorForConversion(m_type);
+ // First convert the value from m_type to canonical type.
+ double factor = conversionToCanonicalUnitsScaleFactor(sourceUnitType);
convertedValue *= factor;
- // Now convert from CSSPixels to the specified unitType
- factor = scaleFactorForConversion(unitType);
+ // Now convert from canonical type to the target unitType.
+ factor = conversionToCanonicalUnitsScaleFactor(targetUnitType);
convertedValue /= factor;
- return convertedValue;
+ *result = convertedValue;
+ return true;
}
-
-void CSSPrimitiveValue::setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode& ec)
+void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionCode& ec)
{
- ec = 0;
-
- if (m_type < CSS_STRING || m_type > CSS_ATTR || stringType < CSS_STRING || stringType > CSS_ATTR) {
- ec = INVALID_ACCESS_ERR;
- return;
- }
-
- cleanup();
-
- if (stringType != CSS_IDENT) {
- m_value.string = stringValue.impl();
- m_value.string->ref();
- m_type = stringType;
- }
- // FIXME: parse ident
+ // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
+ // No other engine supports mutating style through this API. Computed style is always read-only anyway.
+ // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
+ ec = NO_MODIFICATION_ALLOWED_ERR;
}
String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const
@@ -523,7 +600,6 @@ String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const
case CSS_STRING:
case CSS_ATTR:
case CSS_URI:
- case CSS_PARSER_VARIABLE_FUNCTION_SYNTAX:
return m_value.string;
case CSS_IDENT:
return valueOrPropertyName(m_value.ident);
@@ -541,7 +617,6 @@ String CSSPrimitiveValue::getStringValue() const
case CSS_STRING:
case CSS_ATTR:
case CSS_URI:
- case CSS_PARSER_VARIABLE_FUNCTION_SYNTAX:
return m_value.string;
case CSS_IDENT:
return valueOrPropertyName(m_value.ident);
@@ -608,7 +683,7 @@ bool CSSPrimitiveValue::parseString(const String& /*string*/, bool /*strict*/)
return false;
}
-int CSSPrimitiveValue::getIdent()
+int CSSPrimitiveValue::getIdent() const
{
if (m_type != CSS_IDENT)
return 0;
@@ -823,11 +898,6 @@ String CSSPrimitiveValue::cssText() const
}
break;
#endif
- case CSS_PARSER_VARIABLE_FUNCTION_SYNTAX:
- text = "-webkit-var(";
- text += m_value.string;
- text += ")";
- break;
case CSS_PARSER_OPERATOR: {
char c = static_cast<char>(m_value.ident);
text = String(&c, 1U);
@@ -877,7 +947,6 @@ CSSParserValue CSSPrimitiveValue::parserValue() const
break;
case CSS_STRING:
case CSS_URI:
- case CSS_PARSER_VARIABLE_FUNCTION_SYNTAX:
case CSS_PARSER_HEXCOLOR:
value.string.characters = const_cast<UChar*>(m_value.string->characters());
value.string.length = m_value.string->length();
diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h
index bb3ea70..e12cd4c 100644
--- a/WebCore/css/CSSPrimitiveValue.h
+++ b/WebCore/css/CSSPrimitiveValue.h
@@ -83,17 +83,27 @@ public:
// These next types are just used internally to allow us to translate back and forth from CSSPrimitiveValues to CSSParserValues.
CSS_PARSER_OPERATOR = 103,
CSS_PARSER_INTEGER = 104,
- CSS_PARSER_VARIABLE_FUNCTION_SYNTAX = 105,
- CSS_PARSER_HEXCOLOR = 106,
+ CSS_PARSER_HEXCOLOR = 105,
// This is used internally for unknown identifiers
- CSS_PARSER_IDENTIFIER = 107,
+ CSS_PARSER_IDENTIFIER = 106,
// These are from CSS3 Values and Units, but that isn't a finished standard yet
- CSS_TURN = 108,
- CSS_REMS = 109
+ CSS_TURN = 107,
+ CSS_REMS = 108
};
+ // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.
+ enum UnitCategory {
+ UNumber,
+ UPercent,
+ ULength,
+ UAngle,
+ UTime,
+ UFrequency,
+ UOther
+ };
+
static bool isUnitTypeLength(int type) { return (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) ||
type == CSSPrimitiveValue::CSS_REMS; }
@@ -113,8 +123,6 @@ public:
unsigned short primitiveType() const { return m_type; }
- bool isVariable() const { return m_type == CSS_PARSER_VARIABLE_FUNCTION_SYNTAX; }
-
/*
* computes a length in pixels out of the given CSSValue. Need the RenderStyle to get
* the fontinfo in case val is defined in em or ex.
@@ -138,17 +146,17 @@ public:
// use with care!!!
void setPrimitiveType(unsigned short type) { m_type = type; }
- double getDoubleValue(unsigned short unitType, ExceptionCode&);
- double getDoubleValue(unsigned short unitType);
+ double getDoubleValue(unsigned short unitType, ExceptionCode&) const;
+ double getDoubleValue(unsigned short unitType) const;
double getDoubleValue() const { return m_value.num; }
void setFloatValue(unsigned short unitType, double floatValue, ExceptionCode&);
- float getFloatValue(unsigned short unitType, ExceptionCode& ec) { return static_cast<float>(getDoubleValue(unitType, ec)); }
- float getFloatValue(unsigned short unitType) { return static_cast<float>(getDoubleValue(unitType)); }
+ float getFloatValue(unsigned short unitType, ExceptionCode& ec) const { return static_cast<float>(getDoubleValue(unitType, ec)); }
+ float getFloatValue(unsigned short unitType) const { return static_cast<float>(getDoubleValue(unitType)); }
float getFloatValue() const { return static_cast<float>(m_value.num); }
- int getIntValue(unsigned short unitType, ExceptionCode& ec) { return static_cast<int>(getDoubleValue(unitType, ec)); }
- int getIntValue(unsigned short unitType) { return static_cast<int>(getDoubleValue(unitType)); }
+ int getIntValue(unsigned short unitType, ExceptionCode& ec) const { return static_cast<int>(getDoubleValue(unitType, ec)); }
+ int getIntValue(unsigned short unitType) const { return static_cast<int>(getDoubleValue(unitType)); }
int getIntValue() const { return static_cast<int>(m_value.num); }
void setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode&);
@@ -169,7 +177,7 @@ public:
DashboardRegion* getDashboardRegionValue() const { return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region; }
- int getIdent();
+ int getIdent() const;
template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
virtual bool parseString(const String&, bool = false);
@@ -204,10 +212,13 @@ private:
static PassRefPtr<CSSPrimitiveValue> createUncachedColor(unsigned rgbValue);
static PassRefPtr<CSSPrimitiveValue> createUncached(double value, UnitTypes type);
+ static UnitTypes canonicalUnitTypeForCategory(UnitCategory category);
+
void init(PassRefPtr<Counter>);
void init(PassRefPtr<Rect>);
void init(PassRefPtr<Pair>);
void init(PassRefPtr<DashboardRegion>); // FIXME: Dashboard region should not be a primitive value.
+ bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
virtual bool isPrimitiveValue() const { return true; }
diff --git a/WebCore/css/CSSProperty.cpp b/WebCore/css/CSSProperty.cpp
index 61300a2..1e04da7 100644
--- a/WebCore/css/CSSProperty.cpp
+++ b/WebCore/css/CSSProperty.cpp
@@ -29,8 +29,6 @@ namespace WebCore {
String CSSProperty::cssText() const
{
- if (id() == CSSPropertyWebkitVariableDeclarationBlock)
- return m_value->cssText() + ";";
return String(getPropertyName(static_cast<CSSPropertyID>(id()))) + ": " + m_value->cssText() + (isImportant() ? " !important" : "") + "; ";
}
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index ab75404..28b393c 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -297,4 +297,3 @@ z-index
-webkit-user-drag
-webkit-user-modify
-webkit-user-select
--webkit-variable-declaration-block
diff --git a/WebCore/css/CSSReflectValue.h b/WebCore/css/CSSReflectValue.h
index d61f8c4..1dcb1be 100644
--- a/WebCore/css/CSSReflectValue.h
+++ b/WebCore/css/CSSReflectValue.h
@@ -59,6 +59,8 @@ private:
, m_mask(mask)
{
}
+
+ virtual bool isReflectValue() const { return true; }
CSSReflectionDirection m_direction;
RefPtr<CSSPrimitiveValue> m_offset;
diff --git a/WebCore/css/CSSRule.h b/WebCore/css/CSSRule.h
index 1ffca93..4d2de8a 100644
--- a/WebCore/css/CSSRule.h
+++ b/WebCore/css/CSSRule.h
@@ -46,8 +46,8 @@ public:
MEDIA_RULE,
FONT_FACE_RULE,
PAGE_RULE,
- VARIABLES_RULE,
- WEBKIT_KEYFRAMES_RULE,
+ // 7 used to be VARIABLES_RULE
+ WEBKIT_KEYFRAMES_RULE = 8,
WEBKIT_KEYFRAME_RULE
};
diff --git a/WebCore/css/CSSRule.idl b/WebCore/css/CSSRule.idl
index eaf1335..82a1dee 100644
--- a/WebCore/css/CSSRule.idl
+++ b/WebCore/css/CSSRule.idl
@@ -34,7 +34,6 @@ module css {
const unsigned short MEDIA_RULE = 4;
const unsigned short FONT_FACE_RULE = 5;
const unsigned short PAGE_RULE = 6;
- const unsigned short VARIABLES_RULE = 7;
const unsigned short WEBKIT_KEYFRAMES_RULE = 8;
const unsigned short WEBKIT_KEYFRAME_RULE = 9;
diff --git a/WebCore/css/CSSSegmentedFontFace.cpp b/WebCore/css/CSSSegmentedFontFace.cpp
index bda29f0..cdabec1 100644
--- a/WebCore/css/CSSSegmentedFontFace.cpp
+++ b/WebCore/css/CSSSegmentedFontFace.cpp
@@ -88,7 +88,7 @@ FontData* CSSSegmentedFontFace::getFontData(const FontDescription& fontDescripti
return 0;
FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
- unsigned hashKey = fontDescription.computedPixelSize() << FontTraitsMaskWidth | desiredTraitsMask;
+ unsigned hashKey = (fontDescription.computedPixelSize() << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask;
SegmentedFontData* fontData = m_fontDataTable.get(hashKey);
if (fontData)
diff --git a/WebCore/css/CSSStyleDeclaration.cpp b/WebCore/css/CSSStyleDeclaration.cpp
index 996d573..422dd0d 100644
--- a/WebCore/css/CSSStyleDeclaration.cpp
+++ b/WebCore/css/CSSStyleDeclaration.cpp
@@ -148,16 +148,12 @@ PassRefPtr<CSSMutableStyleDeclaration> CSSStyleDeclaration::copyPropertiesInSet(
{
Vector<CSSProperty> list;
list.reserveInitialCapacity(length);
- unsigned variableDependentValueCount = 0;
for (unsigned i = 0; i < length; i++) {
RefPtr<CSSValue> value = getPropertyCSSValue(set[i]);
- if (value) {
- if (value->isVariableDependentValue())
- variableDependentValueCount++;
+ if (value)
list.append(CSSProperty(set[i], value.release(), false));
- }
}
- return CSSMutableStyleDeclaration::create(list, variableDependentValueCount);
+ return CSSMutableStyleDeclaration::create(list);
}
} // namespace WebCore
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 750f6e7..a534247 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -44,9 +44,6 @@
#include "CSSStyleSheet.h"
#include "CSSTimingFunctionValue.h"
#include "CSSValueList.h"
-#include "CSSVariableDependentValue.h"
-#include "CSSVariablesDeclaration.h"
-#include "CSSVariablesRule.h"
#include "CachedImage.h"
#include "Counter.h"
#include "FocusController.h"
@@ -361,7 +358,7 @@ public:
void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0);
- void addStyleRule(StyleBase* item);
+ void addStyleRule(CSSStyleRule* item);
void addRule(CSSStyleRule* rule, CSSSelector* sel);
void addPageRule(CSSStyleRule* rule, CSSSelector* sel);
void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map,
@@ -571,87 +568,7 @@ static void loadViewSourceStyle()
void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* decl)
{
- if (!decl->hasVariableDependentValue()) {
- m_matchedDecls.append(decl);
- return;
- }
-
- // See if we have already resolved the variables in this declaration.
- CSSMutableStyleDeclaration* resolvedDecl = m_resolvedVariablesDeclarations.get(decl).get();
- if (resolvedDecl) {
- m_matchedDecls.append(resolvedDecl);
- return;
- }
-
- // If this declaration has any variables in it, then we need to make a cloned
- // declaration with as many variables resolved as possible for this style selector's media.
- RefPtr<CSSMutableStyleDeclaration> newDecl = CSSMutableStyleDeclaration::create(decl->parentRule());
- m_matchedDecls.append(newDecl.get());
- m_resolvedVariablesDeclarations.set(decl, newDecl);
-
- HashSet<String> usedBlockVariables;
- resolveVariablesForDeclaration(decl, newDecl.get(), usedBlockVariables);
-}
-
-void CSSStyleSelector::resolveVariablesForDeclaration(CSSMutableStyleDeclaration* decl, CSSMutableStyleDeclaration* newDecl, HashSet<String>& usedBlockVariables)
-{
- // Now iterate over the properties in the original declaration. As we resolve variables we'll end up
- // mutating the new declaration (possibly expanding shorthands). The new declaration has no m_node
- // though, so it can't mistakenly call setChanged on anything.
- CSSMutableStyleDeclaration::const_iterator end = decl->end();
- for (CSSMutableStyleDeclaration::const_iterator it = decl->begin(); it != end; ++it) {
- const CSSProperty& current = *it;
- if (!current.value()->isVariableDependentValue()) {
- // We can just add the parsed property directly.
- newDecl->addParsedProperty(current);
- continue;
- }
- CSSValueList* valueList = static_cast<CSSVariableDependentValue*>(current.value())->valueList();
- if (!valueList)
- continue;
- CSSParserValueList resolvedValueList;
- unsigned s = valueList->length();
- bool fullyResolved = true;
- for (unsigned i = 0; i < s; ++i) {
- CSSValue* val = valueList->item(i);
- CSSPrimitiveValue* primitiveValue = val->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(val) : 0;
- if (primitiveValue && primitiveValue->isVariable()) {
- CSSVariablesRule* rule = m_variablesMap.get(primitiveValue->getStringValue());
- if (!rule || !rule->variables()) {
- fullyResolved = false;
- break;
- }
-
- if (current.id() == CSSPropertyWebkitVariableDeclarationBlock && s == 1) {
- fullyResolved = false;
- if (!usedBlockVariables.contains(primitiveValue->getStringValue())) {
- CSSMutableStyleDeclaration* declBlock = rule->variables()->getParsedVariableDeclarationBlock(primitiveValue->getStringValue());
- if (declBlock) {
- usedBlockVariables.add(primitiveValue->getStringValue());
- resolveVariablesForDeclaration(declBlock, newDecl, usedBlockVariables);
- }
- }
- }
-
- CSSValueList* resolvedVariable = rule->variables()->getParsedVariable(primitiveValue->getStringValue());
- if (!resolvedVariable) {
- fullyResolved = false;
- break;
- }
- unsigned valueSize = resolvedVariable->length();
- for (unsigned j = 0; j < valueSize; ++j)
- resolvedValueList.addValue(resolvedVariable->item(j)->parserValue());
- } else
- resolvedValueList.addValue(val->parserValue());
- }
-
- if (!fullyResolved)
- continue;
-
- // We now have a fully resolved new value list. We want the parser to use this value list
- // and parse our new declaration.
- CSSParser(m_checker.m_strictParsing).parsePropertyWithResolvedVariables(current.id(), current.isImportant(), newDecl, &resolvedValueList);
- }
+ m_matchedDecls.append(decl);
}
void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules)
@@ -1609,7 +1526,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
PassRefPtr<RenderStyle> CSSStyleSelector::styleForPage(int pageIndex)
{
- initForStyleResolve(m_checker.m_document->body());
+ initForStyleResolve(m_checker.m_document->documentElement()); // m_rootElementStyle will be set to the document style.
m_style = RenderStyle::create();
m_style->inheritFrom(m_rootElementStyle);
@@ -2785,23 +2702,6 @@ bool CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass(CSSSelector* s
}
}
-void CSSStyleSelector::addVariables(CSSVariablesRule* variables)
-{
- CSSVariablesDeclaration* decl = variables->variables();
- if (!decl)
- return;
- unsigned size = decl->length();
- for (unsigned i = 0; i < size; ++i) {
- String name = decl->item(i);
- m_variablesMap.set(name, variables);
- }
-}
-
-CSSValue* CSSStyleSelector::resolveVariableDependentValue(CSSVariableDependentValue*)
-{
- return 0;
-}
-
// -----------------------------------------------------------------
CSSRuleSet::CSSRuleSet()
@@ -2876,9 +2776,8 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat
for (int i = 0; i < len; i++) {
StyleBase* item = sheet->item(i);
- if (item->isStyleRule()) {
- addStyleRule(item);
- }
+ if (item->isStyleRule())
+ addStyleRule(static_cast<CSSStyleRule*>(item));
else if (item->isImportRule()) {
CSSImportRule* import = static_cast<CSSImportRule*>(item);
if (!import->media() || medium.eval(import->media(), styleSelector))
@@ -2894,7 +2793,7 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat
CSSRule *childItem = rules->item(j);
if (childItem->isStyleRule()) {
// It is a StyleRule, so append it to our list
- addStyleRule(childItem);
+ addStyleRule(static_cast<CSSStyleRule*>(childItem));
} else if (childItem->isFontFaceRule() && styleSelector) {
// Add this font face to our set.
const CSSFontFaceRule* fontFaceRule = static_cast<CSSFontFaceRule*>(childItem);
@@ -2909,23 +2808,17 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat
// Add this font face to our set.
const CSSFontFaceRule* fontFaceRule = static_cast<CSSFontFaceRule*>(item);
styleSelector->fontSelector()->addFontFaceRule(fontFaceRule);
- } else if (item->isVariablesRule()) {
- // Evaluate the media query and make sure it matches.
- CSSVariablesRule* variables = static_cast<CSSVariablesRule*>(item);
- if (!variables->media() || medium.eval(variables->media(), styleSelector))
- styleSelector->addVariables(variables);
} else if (item->isKeyframesRule())
styleSelector->addKeyframeStyle(static_cast<WebKitCSSKeyframesRule*>(item));
}
}
-void CSSRuleSet::addStyleRule(StyleBase* item)
+void CSSRuleSet::addStyleRule(CSSStyleRule* rule)
{
- if (item->isPageRule()) {
- CSSPageRule* pageRule = static_cast<CSSPageRule*>(item);
+ if (rule->isPageRule()) {
+ CSSPageRule* pageRule = static_cast<CSSPageRule*>(rule);
addPageRule(pageRule, pageRule->selectorList().first());
} else {
- CSSStyleRule* rule = static_cast<CSSStyleRule*>(item);
for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s))
addRule(rule, s);
}
@@ -3079,7 +2972,14 @@ static void applyCounterList(RenderStyle* style, CSSValueList* list, bool isRese
int length = list ? list->length() : 0;
for (int i = 0; i < length; ++i) {
- Pair* pair = static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(i))->getPairValue();
+ CSSValue* currValue = list->itemWithoutBoundsCheck(i);
+ if (!currValue->isPrimitiveValue())
+ continue;
+
+ Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
+ if (!pair || !pair->first() || !pair->second())
+ continue;
+
AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
// FIXME: What about overflow?
int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
@@ -3566,10 +3466,12 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
primitiveValue = static_cast<CSSPrimitiveValue*>(item);
int type = primitiveValue->primitiveType();
if (type == CSSPrimitiveValue::CSS_URI) {
- CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);
- if (image->updateIfSVGCursorIsUsed(m_element)) // Elements with SVG cursors are not allowed to share style.
- m_style->setUnique();
- m_style->addCursor(cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());
+ if (primitiveValue->isCursorImageValue()) {
+ CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);
+ if (image->updateIfSVGCursorIsUsed(m_element)) // Elements with SVG cursors are not allowed to share style.
+ m_style->setUnique();
+ m_style->addCursor(cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());
+ }
} else if (type == CSSPrimitiveValue::CSS_IDENT)
m_style->setCursor(*primitiveValue);
}
@@ -4306,10 +4208,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (!item->isPrimitiveValue())
continue;
- CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item);
- switch (val->primitiveType()) {
+ CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
+ switch (contentValue->primitiveType()) {
case CSSPrimitiveValue::CSS_STRING:
- m_style->setContent(val->getStringValue().impl(), didSet);
+ m_style->setContent(contentValue->getStringValue().impl(), didSet);
didSet = true;
break;
case CSSPrimitiveValue::CSS_ATTR: {
@@ -4318,7 +4220,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setUnique();
else
m_parentStyle->setUnique();
- QualifiedName attr(nullAtom, val->getStringValue().impl(), nullAtom);
+ QualifiedName attr(nullAtom, contentValue->getStringValue().impl(), nullAtom);
m_style->setContent(m_element->getAttribute(attr).impl(), didSet);
didSet = true;
// register the fact that the attribute value affects the style
@@ -4326,12 +4228,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
break;
}
case CSSPrimitiveValue::CSS_URI: {
- m_style->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(val)), didSet);
+ if (!contentValue->isImageValue())
+ break;
+ m_style->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(contentValue)), didSet);
didSet = true;
break;
}
case CSSPrimitiveValue::CSS_COUNTER: {
- Counter* counterValue = val->getCounterValue();
+ Counter* counterValue = contentValue->getCounterValue();
OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(),
(EListStyleType)counterValue->listStyleNumber(), counterValue->separator()));
m_style->setContent(counter.release(), didSet);
@@ -4393,13 +4297,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
CSSValue* item = list->itemWithoutBoundsCheck(i);
if (!item->isPrimitiveValue())
continue;
- CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item);
+ CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
AtomicString face;
Settings* settings = m_checker.m_document->settings();
- if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING)
- face = static_cast<FontFamilyValue*>(val)->familyName();
- else if (val->primitiveType() == CSSPrimitiveValue::CSS_IDENT && settings) {
- switch (val->getIdent()) {
+ if (contentValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
+ if (contentValue->isFontFamilyValue())
+ face = static_cast<FontFamilyValue*>(contentValue)->familyName();
+ } else if (contentValue->primitiveType() == CSSPrimitiveValue::CSS_IDENT && settings) {
+ switch (contentValue->getIdent()) {
case CSSValueWebkitBody:
face = settings->standardFontFamily();
break;
@@ -4460,13 +4365,15 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
// do nothing
} else {
- if (!value->isValueList()) return;
+ if (!value->isValueList())
+ return;
CSSValueList *list = static_cast<CSSValueList*>(value);
int len = list->length();
for (int i = 0; i < len; i++)
{
CSSValue *item = list->itemWithoutBoundsCheck(i);
- if (!item->isPrimitiveValue()) continue;
+ if (!item->isPrimitiveValue())
+ continue;
primitiveValue = static_cast<CSSPrimitiveValue*>(item);
switch (primitiveValue->getIdent()) {
case CSSValueNone:
@@ -4800,7 +4707,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
Pair* pair = primitiveValue->getPairValue();
- if (!pair)
+ if (!pair || !pair->first() || !pair->second())
return;
Length radiusWidth;
@@ -4878,6 +4785,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
CSSValueList *list = static_cast<CSSValueList*>(value);
int len = list->length();
for (int i = 0; i < len; i++) {
+ CSSValue* currValue = list->itemWithoutBoundsCheck(i);
+ if (!currValue->isShadowValue())
+ continue;
ShadowValue* item = static_cast<ShadowValue*>(list->itemWithoutBoundsCheck(i));
int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
@@ -4901,6 +4811,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setBoxReflect(RenderStyle::initialBoxReflect());
return;
}
+
+ if (!value->isReflectValue())
+ return;
+
CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value);
RefPtr<StyleReflection> reflection = StyleReflection::create();
reflection->setDirection(reflectValue->direction());
@@ -5348,7 +5262,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
case CSSPropertyWebkitTransformOriginX: {
HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (!primitiveValue)
+ return;
Length l;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
@@ -5362,7 +5277,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
case CSSPropertyWebkitTransformOriginY: {
HANDLE_INHERIT_AND_INITIAL(transformOriginY, TransformOriginY)
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (!primitiveValue)
+ return;
Length l;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
@@ -5376,7 +5292,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
case CSSPropertyWebkitTransformOriginZ: {
HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (!primitiveValue)
+ return;
float f;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
@@ -5418,7 +5335,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
case CSSPropertyWebkitPerspectiveOriginX: {
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (!primitiveValue)
+ return;
Length l;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
@@ -5432,7 +5350,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
case CSSPropertyWebkitPerspectiveOriginY: {
HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (!primitiveValue)
+ return;
Length l;
int type = primitiveValue->primitiveType();
if (CSSPrimitiveValue::isUnitTypeLength(type))
@@ -5524,6 +5443,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertySpeak:
HANDLE_INHERIT_AND_INITIAL(speak, Speak);
+ if (!primitiveValue)
+ return;
m_style->setSpeak(*primitiveValue);
return;
@@ -5585,7 +5506,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyWebkitFontSizeDelta:
case CSSPropertyWebkitTextDecorationsInEffect:
case CSSPropertyWebkitTextStroke:
- case CSSPropertyWebkitVariableDeclarationBlock:
return;
#if ENABLE(WCSS)
case CSSPropertyWapInputFormat:
@@ -6072,15 +5992,12 @@ void CSSStyleSelector::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* va
}
Pair* pair = primitiveValue->getPairValue();
- if (!pair)
+ if (!pair || !pair->first() || !pair->second())
return;
CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
- if (!first || !second)
- return;
-
Length firstLength, secondLength;
int firstType = first->primitiveType();
int secondType = second->primitiveType();
@@ -6165,6 +6082,9 @@ void CSSStyleSelector::mapAnimationDelay(Animation* animation, CSSValue* value)
return;
}
+ if (!value->isPrimitiveValue())
+ return;
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_S)
animation->setDelay(primitiveValue->getFloatValue());
@@ -6179,6 +6099,9 @@ void CSSStyleSelector::mapAnimationDirection(Animation* layer, CSSValue* value)
return;
}
+ if (!value->isPrimitiveValue())
+ return;
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
layer->setDirection(primitiveValue->getIdent() == CSSValueAlternate ? Animation::AnimationDirectionAlternate : Animation::AnimationDirectionNormal);
}
@@ -6207,6 +6130,9 @@ void CSSStyleSelector::mapAnimationFillMode(Animation* layer, CSSValue* value)
return;
}
+ if (!value->isPrimitiveValue())
+ return;
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
switch (primitiveValue->getIdent()) {
case CSSValueNone:
@@ -6248,8 +6174,10 @@ void CSSStyleSelector::mapAnimationName(Animation* layer, CSSValue* value)
return;
}
+ if (!value->isPrimitiveValue())
+ return;
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-
if (primitiveValue->getIdent() == CSSValueNone)
layer->setIsNoneAnimation(true);
else
@@ -6263,6 +6191,9 @@ void CSSStyleSelector::mapAnimationPlayState(Animation* layer, CSSValue* value)
return;
}
+ if (!value->isPrimitiveValue())
+ return;
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying;
layer->setPlayState(playState);
@@ -6338,7 +6269,7 @@ void CSSStyleSelector::mapAnimationTimingFunction(Animation* animation, CSSValue
void CSSStyleSelector::mapNinePieceImage(CSSPropertyID property, CSSValue* value, NinePieceImage& image)
{
// If we're a primitive value, then we are "none" and don't need to alter the empty image at all.
- if (!value || value->isPrimitiveValue())
+ if (!value || value->isPrimitiveValue() || !value->isBorderImageValue())
return;
// Retrieve the border image value.
@@ -6505,7 +6436,7 @@ float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, Ren
// Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various
// platforms (I'm looking at you, Windows.)
- return min(1000000.0f, max(zoomedSize, 1.0f));
+ return min(1000000.0f, zoomedSize);
}
const int fontSizeTableMax = 16;
@@ -6742,241 +6673,266 @@ static TransformOperation::OperationType getTransformOperationType(WebKitCSSTran
bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)
{
- float zoomFactor = style ? style->effectiveZoom() : 1;
+ if (!inValue || !inValue->isValueList()) {
+ outOperations.clear();
+ return false;
+ }
+ float zoomFactor = style ? style->effectiveZoom() : 1;
TransformOperations operations;
- if (inValue && !inValue->isPrimitiveValue()) {
- CSSValueList* list = static_cast<CSSValueList*>(inValue);
- unsigned size = list->length();
- for (unsigned i = 0; i < size; i++) {
- WebKitCSSTransformValue* val = static_cast<WebKitCSSTransformValue*>(list->itemWithoutBoundsCheck(i));
-
- CSSPrimitiveValue* firstValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(0));
-
- switch (val->operationType()) {
- case WebKitCSSTransformValue::ScaleTransformOperation:
- case WebKitCSSTransformValue::ScaleXTransformOperation:
- case WebKitCSSTransformValue::ScaleYTransformOperation: {
- double sx = 1.0;
- double sy = 1.0;
- if (val->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
- sy = firstValue->getDoubleValue();
- else {
- sx = firstValue->getDoubleValue();
- if (val->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
- if (val->length() > 1) {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- sy = secondValue->getDoubleValue();
- } else
- sy = sx;
- }
+ CSSValueList* list = static_cast<CSSValueList*>(inValue);
+ unsigned size = list->length();
+ for (unsigned i = 0; i < size; i++) {
+ CSSValue* currValue = list->itemWithoutBoundsCheck(i);
+ if (!currValue->isWebKitCSSTransformValue())
+ continue;
+
+ WebKitCSSTransformValue* transformValue = static_cast<WebKitCSSTransformValue*>(list->itemWithoutBoundsCheck(i));
+ if (!transformValue->length())
+ continue;
+
+ bool haveNonPrimitiveValue = false;
+ for (unsigned j = 0; j < transformValue->length(); ++j) {
+ if (!transformValue->itemWithoutBoundsCheck(j)->isPrimitiveValue()) {
+ haveNonPrimitiveValue = true;
+ break;
+ }
+ }
+ if (haveNonPrimitiveValue)
+ continue;
+
+ CSSPrimitiveValue* firstValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(0));
+
+ switch (transformValue->operationType()) {
+ case WebKitCSSTransformValue::ScaleTransformOperation:
+ case WebKitCSSTransformValue::ScaleXTransformOperation:
+ case WebKitCSSTransformValue::ScaleYTransformOperation: {
+ double sx = 1.0;
+ double sy = 1.0;
+ if (transformValue->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
+ sy = firstValue->getDoubleValue();
+ else {
+ sx = firstValue->getDoubleValue();
+ if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
+ if (transformValue->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ sy = secondValue->getDoubleValue();
+ } else
+ sy = sx;
}
- operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(val->operationType())));
- break;
}
- case WebKitCSSTransformValue::ScaleZTransformOperation:
- case WebKitCSSTransformValue::Scale3DTransformOperation: {
- double sx = 1.0;
- double sy = 1.0;
- double sz = 1.0;
- if (val->operationType() == WebKitCSSTransformValue::ScaleZTransformOperation)
- sz = firstValue->getDoubleValue();
- else if (val->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
- sy = firstValue->getDoubleValue();
- else {
- sx = firstValue->getDoubleValue();
- if (val->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
- if (val->length() > 2) {
- CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
- sz = thirdValue->getDoubleValue();
- }
- if (val->length() > 1) {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- sy = secondValue->getDoubleValue();
- } else
- sy = sx;
+ operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::ScaleZTransformOperation:
+ case WebKitCSSTransformValue::Scale3DTransformOperation: {
+ double sx = 1.0;
+ double sy = 1.0;
+ double sz = 1.0;
+ if (transformValue->operationType() == WebKitCSSTransformValue::ScaleZTransformOperation)
+ sz = firstValue->getDoubleValue();
+ else if (transformValue->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
+ sy = firstValue->getDoubleValue();
+ else {
+ sx = firstValue->getDoubleValue();
+ if (transformValue->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
+ if (transformValue->length() > 2) {
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
+ sz = thirdValue->getDoubleValue();
}
+ if (transformValue->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ sy = secondValue->getDoubleValue();
+ } else
+ sy = sx;
}
- operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(val->operationType())));
- break;
}
- case WebKitCSSTransformValue::TranslateTransformOperation:
- case WebKitCSSTransformValue::TranslateXTransformOperation:
- case WebKitCSSTransformValue::TranslateYTransformOperation: {
- bool ok = true;
- Length tx = Length(0, Fixed);
- Length ty = Length(0, Fixed);
- if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
- ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
- else {
- tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
- if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
- if (val->length() > 1) {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
- }
+ operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::TranslateTransformOperation:
+ case WebKitCSSTransformValue::TranslateXTransformOperation:
+ case WebKitCSSTransformValue::TranslateYTransformOperation: {
+ bool ok = true;
+ Length tx = Length(0, Fixed);
+ Length ty = Length(0, Fixed);
+ if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
+ ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
+ else {
+ tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
+ if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
+ if (transformValue->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
}
}
+ }
- if (!ok)
- return false;
+ if (!ok)
+ return false;
- operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(val->operationType())));
- break;
- }
- case WebKitCSSTransformValue::TranslateZTransformOperation:
- case WebKitCSSTransformValue::Translate3DTransformOperation: {
- bool ok = true;
- Length tx = Length(0, Fixed);
- Length ty = Length(0, Fixed);
- Length tz = Length(0, Fixed);
- if (val->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
- tz = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
- else if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
- ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
- else {
- tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
- if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
- if (val->length() > 2) {
- CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
- tz = convertToLength(thirdValue, style, rootStyle, zoomFactor, &ok);
- }
- if (val->length() > 1) {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
- }
+ operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::TranslateZTransformOperation:
+ case WebKitCSSTransformValue::Translate3DTransformOperation: {
+ bool ok = true;
+ Length tx = Length(0, Fixed);
+ Length ty = Length(0, Fixed);
+ Length tz = Length(0, Fixed);
+ if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
+ tz = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
+ else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
+ ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
+ else {
+ tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok);
+ if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
+ if (transformValue->length() > 2) {
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
+ tz = convertToLength(thirdValue, style, rootStyle, zoomFactor, &ok);
+ }
+ if (transformValue->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok);
}
}
+ }
- if (!ok)
- return false;
+ if (!ok)
+ return false;
- operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(val->operationType())));
- break;
- }
- case WebKitCSSTransformValue::RotateTransformOperation: {
- double angle = firstValue->getDoubleValue();
- if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
- angle = rad2deg(angle);
- else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
- angle = grad2deg(angle);
- else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
- angle = turn2deg(angle);
-
- operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(val->operationType())));
- break;
- }
- case WebKitCSSTransformValue::RotateXTransformOperation:
- case WebKitCSSTransformValue::RotateYTransformOperation:
- case WebKitCSSTransformValue::RotateZTransformOperation: {
- double x = 0;
- double y = 0;
- double z = 0;
- double angle = firstValue->getDoubleValue();
- if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
- angle = rad2deg(angle);
- else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
- angle = grad2deg(angle);
-
- if (val->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
- x = 1;
- else if (val->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
- y = 1;
- else
- z = 1;
- operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
- break;
- }
- case WebKitCSSTransformValue::Rotate3DTransformOperation: {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
- CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3));
- double x = firstValue->getDoubleValue();
- double y = secondValue->getDoubleValue();
- double z = thirdValue->getDoubleValue();
- double angle = fourthValue->getDoubleValue();
- if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
- angle = rad2deg(angle);
- else if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
- angle = grad2deg(angle);
- operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
+ operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::RotateTransformOperation: {
+ double angle = firstValue->getDoubleValue();
+ if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
+ angle = turn2deg(angle);
+
+ operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::RotateXTransformOperation:
+ case WebKitCSSTransformValue::RotateYTransformOperation:
+ case WebKitCSSTransformValue::RotateZTransformOperation: {
+ double x = 0;
+ double y = 0;
+ double z = 0;
+ double angle = firstValue->getDoubleValue();
+ if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+
+ if (transformValue->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
+ x = 1;
+ else if (transformValue->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
+ y = 1;
+ else
+ z = 1;
+ operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::Rotate3DTransformOperation: {
+ if (transformValue->length() < 4)
break;
- }
- case WebKitCSSTransformValue::SkewTransformOperation:
- case WebKitCSSTransformValue::SkewXTransformOperation:
- case WebKitCSSTransformValue::SkewYTransformOperation: {
- double angleX = 0;
- double angleY = 0;
- double angle = firstValue->getDoubleValue();
- if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
- angle = rad2deg(angle);
- else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
- angle = grad2deg(angle);
- else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
- angle = turn2deg(angle);
- if (val->operationType() == WebKitCSSTransformValue::SkewYTransformOperation)
- angleY = angle;
- else {
- angleX = angle;
- if (val->operationType() == WebKitCSSTransformValue::SkewTransformOperation) {
- if (val->length() > 1) {
- CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
- angleY = secondValue->getDoubleValue();
- if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
- angleY = rad2deg(angleY);
- else if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
- angleY = grad2deg(angleY);
- else if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
- angleY = turn2deg(angleY);
- }
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
+ CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3));
+ double x = firstValue->getDoubleValue();
+ double y = secondValue->getDoubleValue();
+ double z = thirdValue->getDoubleValue();
+ double angle = fourthValue->getDoubleValue();
+ if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+ operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::SkewTransformOperation:
+ case WebKitCSSTransformValue::SkewXTransformOperation:
+ case WebKitCSSTransformValue::SkewYTransformOperation: {
+ double angleX = 0;
+ double angleY = 0;
+ double angle = firstValue->getDoubleValue();
+ if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
+ angle = turn2deg(angle);
+ if (transformValue->operationType() == WebKitCSSTransformValue::SkewYTransformOperation)
+ angleY = angle;
+ else {
+ angleX = angle;
+ if (transformValue->operationType() == WebKitCSSTransformValue::SkewTransformOperation) {
+ if (transformValue->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
+ angleY = secondValue->getDoubleValue();
+ if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angleY = rad2deg(angleY);
+ else if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angleY = grad2deg(angleY);
+ else if (secondValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
+ angleY = turn2deg(angleY);
}
}
- operations.operations().append(SkewTransformOperation::create(angleX, angleY, getTransformOperationType(val->operationType())));
- break;
- }
- case WebKitCSSTransformValue::MatrixTransformOperation: {
- double a = firstValue->getDoubleValue();
- double b = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue();
- double c = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue();
- double d = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue();
- double e = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue();
- double f = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue();
- operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f));
- break;
}
- case WebKitCSSTransformValue::Matrix3DTransformOperation: {
- TransformationMatrix matrix(static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(0))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(6))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(7))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(8))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(9))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(10))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(11))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(12))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(13))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(14))->getDoubleValue(),
- static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(15))->getDoubleValue());
- operations.operations().append(Matrix3DTransformOperation::create(matrix));
- break;
- }
- case WebKitCSSTransformValue::PerspectiveTransformOperation: {
- double p = firstValue->getDoubleValue();
- if (p < 0.0)
- return false;
- operations.operations().append(PerspectiveTransformOperation::create(p));
+ operations.operations().append(SkewTransformOperation::create(angleX, angleY, getTransformOperationType(transformValue->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::MatrixTransformOperation: {
+ if (transformValue->length() < 6)
break;
- }
- case WebKitCSSTransformValue::UnknownTransformOperation:
- ASSERT_NOT_REACHED();
+ double a = firstValue->getDoubleValue();
+ double b = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue();
+ double c = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue();
+ double d = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue();
+ double e = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue();
+ double f = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue();
+ operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f));
+ break;
+ }
+ case WebKitCSSTransformValue::Matrix3DTransformOperation: {
+ if (transformValue->length() < 16)
break;
+ TransformationMatrix matrix(static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(0))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(3))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(4))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(5))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(6))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(7))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(8))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(9))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(10))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(11))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(12))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(13))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(14))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(15))->getDoubleValue());
+ operations.operations().append(Matrix3DTransformOperation::create(matrix));
+ break;
+ }
+ case WebKitCSSTransformValue::PerspectiveTransformOperation: {
+ double p = firstValue->getDoubleValue();
+ if (p < 0.0)
+ return false;
+ operations.operations().append(PerspectiveTransformOperation::create(p));
+ break;
}
+ case WebKitCSSTransformValue::UnknownTransformOperation:
+ ASSERT_NOT_REACHED();
+ break;
}
}
+
outOperations = operations;
return true;
}
diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h
index 20cd866..b718751 100644
--- a/WebCore/css/CSSStyleSelector.h
+++ b/WebCore/css/CSSStyleSelector.h
@@ -50,8 +50,6 @@ class CSSSelector;
class CSSStyleRule;
class CSSStyleSheet;
class CSSValue;
-class CSSVariableDependentValue;
-class CSSVariablesRule;
class ContainerNode;
class DataGridColumn;
class Document;
@@ -165,10 +163,6 @@ public:
void allVisitedStateChanged() { m_checker.allVisitedStateChanged(); }
void visitedStateChanged(LinkHash visitedHash) { m_checker.visitedStateChanged(visitedHash); }
- void addVariables(CSSVariablesRule* variables);
- CSSValue* resolveVariableDependentValue(CSSVariableDependentValue*);
- void resolveVariablesForDeclaration(CSSMutableStyleDeclaration* decl, CSSMutableStyleDeclaration* newDecl, HashSet<String>& usedBlockVariables);
-
void addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule);
void addPageStyle(PassRefPtr<CSSPageRule>);
@@ -319,9 +313,6 @@ public:
HashSet<AtomicStringImpl*> m_selectorAttrs;
Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
-
- HashMap<String, CSSVariablesRule*> m_variablesMap;
- HashMap<CSSMutableStyleDeclaration*, RefPtr<CSSMutableStyleDeclaration> > m_resolvedVariablesDeclarations;
};
class CSSRuleData : public Noncopyable {
diff --git a/WebCore/css/CSSValue.h b/WebCore/css/CSSValue.h
index 0bd6496..ec1b15e 100644
--- a/WebCore/css/CSSValue.h
+++ b/WebCore/css/CSSValue.h
@@ -53,11 +53,16 @@ public:
virtual String cssText() const = 0;
void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented.
+ virtual bool isBorderImageValue() const { return false; }
+ virtual bool isCursorImageValue() const { return false; }
+ virtual bool isFontFamilyValue() const { return false; }
virtual bool isFontValue() const { return false; }
virtual bool isImageGeneratorValue() const { return false; }
virtual bool isImageValue() const { return false; }
virtual bool isImplicitInitialValue() const { return false; }
virtual bool isPrimitiveValue() const { return false; }
+ virtual bool isReflectValue() const { return false; }
+ virtual bool isShadowValue() const { return false; }
virtual bool isTimingFunctionValue() const { return false; }
virtual bool isValueList() const { return false; }
virtual bool isWebKitCSSTransformValue() const { return false; }
@@ -67,7 +72,6 @@ public:
virtual bool isSVGPaint() const { return false; }
#endif
- virtual bool isVariableDependentValue() const { return false; }
virtual CSSParserValue parserValue() const { ASSERT_NOT_REACHED(); return CSSParserValue(); }
virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*) { }
diff --git a/WebCore/css/CSSVariableDependentValue.cpp b/WebCore/css/CSSVariableDependentValue.cpp
deleted file mode 100644
index 2eadc1c..0000000
--- a/WebCore/css/CSSVariableDependentValue.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 "CSSVariableDependentValue.h"
-
-#include "CSSValueList.h"
-
-namespace WebCore {
-
-CSSVariableDependentValue::CSSVariableDependentValue(PassRefPtr<CSSValueList> list)
-: m_list(list)
-{
-}
-
-CSSVariableDependentValue::~CSSVariableDependentValue()
-{
-}
-
-String CSSVariableDependentValue::cssText() const
-{
- if (m_list)
- return m_list->cssText();
- return "";
-}
-
-}
diff --git a/WebCore/css/CSSVariableDependentValue.h b/WebCore/css/CSSVariableDependentValue.h
deleted file mode 100644
index e8dce2e..0000000
--- a/WebCore/css/CSSVariableDependentValue.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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 CSSVariableDependentValue_h
-#define CSSVariableDependentValue_h
-
-#include "CSSValue.h"
-
-namespace WebCore {
-
-class CSSValueList;
-
-class CSSVariableDependentValue : public CSSValue {
-public:
- static PassRefPtr<CSSVariableDependentValue> create(PassRefPtr<CSSValueList> valueList)
- {
- return adoptRef(new CSSVariableDependentValue(valueList));
- }
- virtual ~CSSVariableDependentValue();
-
- virtual String cssText() const;
-
- bool isVariableDependentValue() const { return true; }
-
- CSSValueList* valueList() const { return m_list.get(); }
-
-private:
- CSSVariableDependentValue(PassRefPtr<CSSValueList>);
-
- RefPtr<CSSValueList> m_list;
-};
-
-}
-#endif
-
diff --git a/WebCore/css/CSSVariablesDeclaration.cpp b/WebCore/css/CSSVariablesDeclaration.cpp
deleted file mode 100644
index e40750a..0000000
--- a/WebCore/css/CSSVariablesDeclaration.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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 "CSSVariablesDeclaration.h"
-
-#include "CSSParser.h"
-#include "CSSRule.h"
-#include "CSSValueList.h"
-#include "Document.h"
-#include "ExceptionCode.h"
-
-namespace WebCore {
-
-CSSVariablesDeclaration::CSSVariablesDeclaration(StyleBase* parent, const Vector<String>& names, const Vector<RefPtr<CSSValue> >& values)
- : StyleBase(parent)
-{
- m_variableNames = names;
- ASSERT(names.size() == values.size());
- unsigned s = names.size();
- for (unsigned i = 0; i < s; ++i)
- addParsedVariable(names[i], values[i], false);
-}
-
-CSSVariablesDeclaration::~CSSVariablesDeclaration()
-{
-}
-
-String CSSVariablesDeclaration::getVariableValue(const String& variableName)
-{
- CSSValue* val = m_variablesMap.get(variableName).get();
- if (val)
- return val->cssText();
- return "";
-}
-
-String CSSVariablesDeclaration::removeVariable(const String& variableName, ExceptionCode&)
-{
- // FIXME: The spec has this method taking an exception code but no exceptions are
- // specified as being thrown.
- RefPtr<CSSValue> val = m_variablesMap.take(variableName);
- String result = val ? val->cssText() : "";
- if (val) {
- int s = m_variableNames.size();
- for (int i = 0; i < s; ++i) {
- if (m_variableNames[i] == variableName) {
- m_variableNames.remove(i);
- i--;
- s--;
- }
- }
-
- setNeedsStyleRecalc();
- }
-
- // FIXME: Communicate this change so that the document will update.
- return result;
-}
-
-void CSSVariablesDeclaration::setVariable(const String& variableName, const String& variableValue, ExceptionCode& excCode)
-{
- // Try to parse the variable value into a Value*. If it fails we throw an exception.
- CSSParser parser(useStrictParsing());
- if (!parser.parseVariable(this, variableName, variableValue)) // If the parse succeeds, it will call addParsedVariable (our internal method for doing the add) with the parsed Value*.
- excCode = SYNTAX_ERR;
- else
- setNeedsStyleRecalc();
-}
-
-void CSSVariablesDeclaration::addParsedVariable(const String& variableName, PassRefPtr<CSSValue> variableValue, bool updateNamesList)
-{
-// FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues.
-#if 0
- variableValue->setParent(this); // Needed to connect variables that are CSSMutableStyleDeclarations, since the parent couldn't be set until now.
-#endif
-
- // Don't leak duplicates. For multiple variables with the same name, the last one
- // declared will win.
- CSSValue* current = m_variablesMap.take(variableName).get();
- if (!current && updateNamesList)
- m_variableNames.append(variableName);
- m_variablesMap.set(variableName, variableValue);
-
- // FIXME: Communicate this change so the document will update.
-}
-
-CSSValueList* CSSVariablesDeclaration::getParsedVariable(const String& variableName)
-{
- CSSValue* result = m_variablesMap.get(variableName).get();
- if (result->isValueList())
- return static_cast<CSSValueList*>(result);
- return 0;
-}
-
-CSSMutableStyleDeclaration* CSSVariablesDeclaration::getParsedVariableDeclarationBlock(const String&)
-{
-// FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues.
-#if 0
- StyleBase* result = m_variablesMap.get(variableName).get();
-
- if (result->isMutableStyleDeclaration())
- return static_cast<CSSMutableStyleDeclaration*>(result);
-#endif
- return 0;
-}
-
-unsigned CSSVariablesDeclaration::length() const
-{
- return m_variableNames.size();
-}
-
-String CSSVariablesDeclaration::item(unsigned index)
-{
- if (index >= m_variableNames.size())
- return "";
- return m_variableNames[index];
-}
-
-CSSRule* CSSVariablesDeclaration::parentRule()
-{
- return (parent() && parent()->isRule()) ? static_cast<CSSRule*>(parent()) : 0;
-}
-
-String CSSVariablesDeclaration::cssText() const
-{
- String result = "{ ";
- unsigned s = m_variableNames.size();
- for (unsigned i = 0; i < s; ++i) {
- result += m_variableNames[i] + ": ";
- result += m_variablesMap.get(m_variableNames[i])->cssText();
- if (i < s - 1)
- result += "; ";
- }
- result += " }";
- return result;
-}
-
-void CSSVariablesDeclaration::setCssText(const String&)
-{
- // FIXME: It's not clear if this is actually settable.
-}
-
-void CSSVariablesDeclaration::setNeedsStyleRecalc()
-{
- // FIXME: Make this much better (it has the same problem CSSMutableStyleDeclaration does).
- StyleBase* root = this;
- while (StyleBase* parent = root->parent())
- root = parent;
- if (root->isCSSStyleSheet())
- static_cast<CSSStyleSheet*>(root)->document()->styleSelectorChanged(DeferRecalcStyle);
-}
-
-}
diff --git a/WebCore/css/CSSVariablesDeclaration.h b/WebCore/css/CSSVariablesDeclaration.h
deleted file mode 100644
index 6838743..0000000
--- a/WebCore/css/CSSVariablesDeclaration.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 CSSVariablesDeclaration_h
-#define CSSVariablesDeclaration_h
-
-#include "PlatformString.h"
-#include "StyleBase.h"
-#include <wtf/HashMap.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-typedef int ExceptionCode;
-
-class CSSMutableStyleDeclaration;
-class CSSRule;
-class CSSValue;
-class CSSValueList;
-
-class CSSVariablesDeclaration : public StyleBase {
-public:
- static PassRefPtr<CSSVariablesDeclaration> create(StyleBase* owningRule, const Vector<String>& names, const Vector<RefPtr<CSSValue> >& values)
- {
- return adoptRef(new CSSVariablesDeclaration(owningRule, names, values));
- }
- virtual ~CSSVariablesDeclaration();
-
- String getVariableValue(const String&);
- String removeVariable(const String&, ExceptionCode&);
- void setVariable(const String&, const String&, ExceptionCode&);
-
- unsigned length() const;
- String item(unsigned index);
-
- CSSRule* parentRule();
-
- String cssText() const;
- void setCssText(const String&); // FIXME: The spec contradicts itself regarding whether or not cssText is settable.
-
- void addParsedVariable(const String& variableName, PassRefPtr<CSSValue> variableValue, bool updateNamesList = true);
-
- CSSValueList* getParsedVariable(const String& variableName);
- CSSMutableStyleDeclaration* getParsedVariableDeclarationBlock(const String& variableName);
-
-private:
- CSSVariablesDeclaration(StyleBase* owningRule, const Vector<String>& names, const Vector<RefPtr<CSSValue> >& values);
-
- void setNeedsStyleRecalc();
-
-protected:
- Vector<String> m_variableNames;
- HashMap<String, RefPtr<CSSValue> > m_variablesMap;
-};
-
-} // namespace WebCore
-
-#endif // CSSVariablesDeclaration_h
diff --git a/WebCore/css/CSSVariablesDeclaration.idl b/WebCore/css/CSSVariablesDeclaration.idl
deleted file mode 100644
index 672bfe2..0000000
--- a/WebCore/css/CSSVariablesDeclaration.idl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-
-module css {
-
- interface [
- HasIndexGetter
- ] CSSVariablesDeclaration {
- attribute DOMString cssText;
-
- DOMString getVariableValue(in DOMString variableName);
- DOMString removeVariable(in DOMString variableName)
- raises(DOMException);
- void setVariable(in DOMString variableName,
- in DOMString value)
- raises(DOMException);
- readonly attribute unsigned long length;
- DOMString item(in unsigned long index);
- readonly attribute CSSRule parentRule;
- };
-
-}
diff --git a/WebCore/css/CSSVariablesRule.cpp b/WebCore/css/CSSVariablesRule.cpp
deleted file mode 100644
index 0771952..0000000
--- a/WebCore/css/CSSVariablesRule.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 "CSSVariablesRule.h"
-
-#include "MediaList.h"
-#include "PlatformString.h"
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-
-CSSVariablesRule::CSSVariablesRule(CSSStyleSheet* parent, MediaList* mediaList, bool variablesKeyword)
- : CSSRule(parent)
- , m_lstMedia(mediaList)
- , m_variablesKeyword(variablesKeyword)
-{
-}
-
-CSSVariablesRule::~CSSVariablesRule()
-{
-}
-
-String CSSVariablesRule::cssText() const
-{
- String result = m_variablesKeyword ? "@-webkit-variables " : "@-webkit-define ";
- if (m_lstMedia) {
- if (!m_variablesKeyword)
- result += "for ";
- result += m_lstMedia->mediaText();
- result += " ";
- }
- if (m_variables)
- result += m_variables->cssText();
- result += ";";
- return result;
-}
-
-}
diff --git a/WebCore/css/CSSVariablesRule.h b/WebCore/css/CSSVariablesRule.h
deleted file mode 100644
index d2cea39..0000000
--- a/WebCore/css/CSSVariablesRule.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 CSSVariablesRule_h
-#define CSSVariablesRule_h
-
-#include "CSSRule.h"
-#include "CSSVariablesDeclaration.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class CSSStyleSheet;
-class MediaList;
-
-class CSSVariablesRule : public CSSRule {
-public:
- static PassRefPtr<CSSVariablesRule> create(CSSStyleSheet* parent, MediaList* mediaList, bool variablesKeyword)
- {
- return adoptRef(new CSSVariablesRule(parent, mediaList, variablesKeyword));
- }
-
- virtual ~CSSVariablesRule();
-
- // CSSVariablesRule interface
- MediaList* media() const { return m_lstMedia.get(); }
- CSSVariablesDeclaration* variables() { return m_variables.get(); }
-
- // Inherited from CSSRule
- virtual unsigned short type() const { return VARIABLES_RULE; }
- virtual String cssText() const;
- virtual bool isVariablesRule() { return true; }
-
- // Used internally. Does not notify the document of the change. Only intended
- // for use on initial parse.
- void setDeclaration(PassRefPtr<CSSVariablesDeclaration> decl) { m_variables = decl; }
-
-private:
- CSSVariablesRule(CSSStyleSheet* parent, MediaList*, bool variablesKeyword);
-
- RefPtr<MediaList> m_lstMedia;
- RefPtr<CSSVariablesDeclaration> m_variables;
- bool m_variablesKeyword;
-};
-
-} // namespace WebCore
-
-#endif // CSSVariablesRule_h
diff --git a/WebCore/css/CSSVariablesRule.idl b/WebCore/css/CSSVariablesRule.idl
deleted file mode 100644
index b7559f6..0000000
--- a/WebCore/css/CSSVariablesRule.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-module css {
-
- interface CSSVariablesRule : CSSRule {
- readonly attribute MediaList media;
- readonly attribute CSSVariablesDeclaration variables;
- };
-
-}
diff --git a/WebCore/css/FontFamilyValue.h b/WebCore/css/FontFamilyValue.h
index 087d22a..3f7d3a3 100644
--- a/WebCore/css/FontFamilyValue.h
+++ b/WebCore/css/FontFamilyValue.h
@@ -41,6 +41,7 @@ public:
private:
FontFamilyValue(const String& familyName);
+ virtual bool isFontFamilyValue() const { return true; }
String m_familyName;
};
diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp
index 5ddaf99..5f3c46b 100644
--- a/WebCore/css/SVGCSSStyleSelector.cpp
+++ b/WebCore/css/SVGCSSStyleSelector.cpp
@@ -161,7 +161,8 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
case CSSPropertyKerning:
{
HANDLE_INHERIT_AND_INITIAL(kerning, Kerning);
- svgstyle->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+ if (primitiveValue)
+ svgstyle->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
break;
}
case CSSPropertyDominantBaseline:
@@ -261,10 +262,11 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
Vector<SVGLength> array;
size_t length = dashes->length();
for (size_t i = 0; i < length; ++i) {
- CSSPrimitiveValue* dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
- if (!dash)
+ CSSValue* currValue = dashes->itemWithoutBoundsCheck(i);
+ if (!currValue->isPrimitiveValue())
continue;
+ CSSPrimitiveValue* dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
array.append(SVGLength::fromCSSPrimitiveValue(dash));
}
@@ -549,8 +551,13 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
return;
CSSValueList *list = static_cast<CSSValueList*>(value);
- ASSERT(list->length() == 1);
- ShadowValue* item = static_cast<ShadowValue*>(list->itemWithoutBoundsCheck(0));
+ if (!list->length())
+ return;
+
+ CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
+ if (!firstValue->isShadowValue())
+ return;
+ ShadowValue* item = static_cast<ShadowValue*>(firstValue);
int x = item->x->computeLengthInt(style(), m_rootElementStyle);
int y = item->y->computeLengthInt(style(), m_rootElementStyle);
int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle) : 0;
diff --git a/WebCore/css/ShadowValue.h b/WebCore/css/ShadowValue.h
index a88a0e7..fab1071 100644
--- a/WebCore/css/ShadowValue.h
+++ b/WebCore/css/ShadowValue.h
@@ -58,6 +58,8 @@ private:
PassRefPtr<CSSPrimitiveValue> spread,
PassRefPtr<CSSPrimitiveValue> style,
PassRefPtr<CSSPrimitiveValue> color);
+
+ virtual bool isShadowValue() const { return true; }
};
} // namespace
diff --git a/WebCore/css/StyleBase.h b/WebCore/css/StyleBase.h
index a53b2c5..94efa01 100644
--- a/WebCore/css/StyleBase.h
+++ b/WebCore/css/StyleBase.h
@@ -53,7 +53,6 @@ namespace WebCore {
virtual bool isKeyframeRule() { return false; }
virtual bool isKeyframesRule() { return false; }
virtual bool isMediaRule() { return false; }
- virtual bool isVariablesRule() { return false; }
virtual bool isPageRule() { return false; }
virtual bool isRule() { return false; }
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 4f20a20..854b63c 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -20,10 +20,29 @@
#include "config.h"
#include "StyleSheet.h"
+#include "HTMLNames.h"
#include "MediaList.h"
+#include "Node.h"
+#include "SVGNames.h"
namespace WebCore {
+#if !ASSERT_DISABLED
+static bool isAcceptableStyleSheetParent(Node* parentNode)
+{
+ // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document.
+ return !parentNode
+ || parentNode->isDocumentNode()
+ || parentNode->hasTagName(HTMLNames::linkTag)
+ || parentNode->hasTagName(HTMLNames::styleTag)
+ || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE
+#if ENABLE(SVG)
+ || parentNode->hasTagName(SVGNames::styleTag)
+#endif
+ ;
+}
+#endif
+
StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL)
: StyleList(parentSheet)
, m_parentNode(0)
@@ -40,6 +59,7 @@ StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL&
, m_finalURL(finalURL)
, m_disabled(false)
{
+ ASSERT(isAcceptableStyleSheetParent(parentNode));
}
StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL)
diff --git a/WebCore/css/StyleSheet.h b/WebCore/css/StyleSheet.h
index 621733d..2ff9a01 100644
--- a/WebCore/css/StyleSheet.h
+++ b/WebCore/css/StyleSheet.h
@@ -40,6 +40,7 @@ public:
void setDisabled(bool disabled) { m_disabled = disabled; styleSheetChanged(); }
Node* ownerNode() const { return m_parentNode; }
+ void clearOwnerNode() { m_parentNode = 0; }
StyleSheet *parentStyleSheet() const;
// Note that href is the URL that started the redirect chain that led to
diff --git a/WebCore/css/WebKitCSSMatrix.cpp b/WebCore/css/WebKitCSSMatrix.cpp
index 3714760..33cc91e 100644
--- a/WebCore/css/WebKitCSSMatrix.cpp
+++ b/WebCore/css/WebKitCSSMatrix.cpp
@@ -36,25 +36,12 @@
namespace WebCore {
-WebKitCSSMatrix::WebKitCSSMatrix()
- : StyleBase(0)
-{
-}
-
-WebKitCSSMatrix::WebKitCSSMatrix(const WebKitCSSMatrix& m)
- : StyleBase(0)
- , m_matrix(m.m_matrix)
-{
-}
-
WebKitCSSMatrix::WebKitCSSMatrix(const TransformationMatrix& m)
- : StyleBase(0)
- , m_matrix(m)
+ : m_matrix(m)
{
}
WebKitCSSMatrix::WebKitCSSMatrix(const String& s, ExceptionCode& ec)
- : StyleBase(0)
{
setMatrixValue(s, ec);
}
@@ -65,7 +52,7 @@ WebKitCSSMatrix::~WebKitCSSMatrix()
void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec)
{
- CSSParser p(useStrictParsing());
+ CSSParser p(true);
RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create();
if (p.parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true)) {
// Convert to TransformOperations. This can fail if a property
diff --git a/WebCore/css/WebKitCSSMatrix.h b/WebCore/css/WebKitCSSMatrix.h
index 56bf76b..2357a69 100644
--- a/WebCore/css/WebKitCSSMatrix.h
+++ b/WebCore/css/WebKitCSSMatrix.h
@@ -28,23 +28,13 @@
#include "ExceptionCode.h"
#include "PlatformString.h"
-#include "StyleBase.h"
#include "TransformationMatrix.h"
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
-class WebKitCSSMatrix : public StyleBase {
+class WebKitCSSMatrix : public RefCounted<WebKitCSSMatrix> {
public:
- static PassRefPtr<WebKitCSSMatrix> create()
- {
- return adoptRef(new WebKitCSSMatrix());
- }
- static PassRefPtr<WebKitCSSMatrix> create(const WebKitCSSMatrix& m)
- {
- return adoptRef(new WebKitCSSMatrix(m));
- }
static PassRefPtr<WebKitCSSMatrix> create(const TransformationMatrix& m)
{
return adoptRef(new WebKitCSSMatrix(m));
@@ -104,7 +94,7 @@ public:
void setM43(double f) { m_matrix.setM43(f); }
void setM44(double f) { m_matrix.setM44(f); }
- void setMatrixValue(const String& string, ExceptionCode&);
+ void setMatrixValue(const String&, ExceptionCode&);
// The following math function return a new matrix with the
// specified operation applied. The this value is not modified.
@@ -146,8 +136,6 @@ public:
String toString() const;
protected:
- WebKitCSSMatrix();
- WebKitCSSMatrix(const WebKitCSSMatrix&);
WebKitCSSMatrix(const TransformationMatrix&);
WebKitCSSMatrix(const String&, ExceptionCode&);
diff --git a/WebCore/css/html.css b/WebCore/css/html.css
index a201adc..d091806 100644
--- a/WebCore/css/html.css
+++ b/WebCore/css/html.css
@@ -229,14 +229,20 @@ caption {
ul, menu, dir {
display: block;
list-style-type: disc;
- margin: 1__qem 0 1em 0;
+ -webkit-margin-before: 1__qem;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0;
+ -webkit-margin-end: 0;
-webkit-padding-start: 40px
}
ol {
display: block;
list-style-type: decimal;
- margin: 1__qem 0 1em 0;
+ -webkit-margin-before: 1__qem;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0;
+ -webkit-margin-end: 0;
-webkit-padding-start: 40px
}
@@ -259,7 +265,10 @@ dd {
dl {
display: block;
- margin: 1__qem 0 1em 0
+ -webkit-margin-before: 1__qem;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0;
+ -webkit-margin-end: 0;
}
dt {
@@ -267,8 +276,8 @@ dt {
}
ol ul, ul ol, ul ul, ol ol {
- margin-top: 0;
- margin-bottom: 0
+ -webkit-margin-before: 0;
+ -webkit-margin-after: 0
}
/* form elements */
diff --git a/WebCore/css/themeQtMobile.css b/WebCore/css/themeQtMobile.css
index 5cc39c8..8b0c548 100644
--- a/WebCore/css/themeQtMobile.css
+++ b/WebCore/css/themeQtMobile.css
@@ -33,7 +33,8 @@ select {
padding: 2px 18px 3px 18px;
border: 1px solid gray;
-webkit-border-radius:5px;
- background: -webkit-gradient(linear, left bottom, left top, color-stop(0.0, #e5e5e5), color-stop(0.4, #ffffff));
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0.0, rgba(0, 0, 0, 0.35)), color-stop(0.4, rgba(0, 0, 0, 0.0)));
+ background-color: #ffffff;
color: #3e3e3e;
}
@@ -76,7 +77,8 @@ input[type="number"],
input[type="url"],
textarea {
border: 1px solid gray;
- background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, #bfbfbf), color-stop(0.2, #ffffff));
+ background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, rgba(0, 0, 0, 0.35)), color-stop(0.2, rgba(0, 0, 0, 0.0)));
+ background-color: #ffffff;
color: #3e3e3e;
-webkit-border-radius:5px;
}
@@ -93,7 +95,8 @@ input[type="number"]:disabled,
input[type="url"]:disabled,
textarea:disabled {
border: 1px solid gray;
- background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, #e5e5e5), color-stop(0.2, #ffffff));
+ background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, rgba(0, 0, 0, 0.3)), color-stop(0.2, rgba(0, 0, 0, 0.0)));
+ background-color: #ffffff;
color: #e5e5e5;
}
diff --git a/WebCore/css/tokenizer.flex b/WebCore/css/tokenizer.flex
index 4d226d9..bd4808d 100644
--- a/WebCore/css/tokenizer.flex
+++ b/WebCore/css/tokenizer.flex
@@ -41,7 +41,6 @@ nth [\+-]?{intnum}*n([\+-]{intnum})?
<mediaquery>"not" {yyTok = MEDIA_NOT; return yyTok;}
<mediaquery>"only" {yyTok = MEDIA_ONLY; return yyTok;}
<mediaquery>"and" {yyTok = MEDIA_AND; return yyTok;}
-<forkeyword>"for" {BEGIN(mediaquery); yyTok = VARIABLES_FOR; return yyTok; }
{string} {yyTok = STRING; return yyTok;}
{ident} {yyTok = IDENT; return yyTok;}
@@ -77,9 +76,6 @@ nth [\+-]?{intnum}*n([\+-]{intnum})?
"@-webkit-value" {yyTok = WEBKIT_VALUE_SYM; return yyTok; }
"@-webkit-mediaquery" {BEGIN(mediaquery); yyTok = WEBKIT_MEDIAQUERY_SYM; return yyTok; }
"@-webkit-selector" {yyTok = WEBKIT_SELECTOR_SYM; return yyTok; }
-"@-webkit-variables" {BEGIN(mediaquery); yyTok = WEBKIT_VARIABLES_SYM; return yyTok; }
-"@-webkit-define" {BEGIN(forkeyword); yyTok = WEBKIT_DEFINE_SYM; return yyTok; }
-"@-webkit-variables-decls" { yyTok = WEBKIT_VARIABLES_DECLS_SYM; return yyTok; }
"@-webkit-keyframes" {yyTok = WEBKIT_KEYFRAMES_SYM; return yyTok; }
"@-webkit-keyframe-rule" {yyTok = WEBKIT_KEYFRAME_RULE_SYM; return yyTok; }
@@ -113,7 +109,6 @@ nth [\+-]?{intnum}*n([\+-]{intnum})?
"not(" {yyTok = NOTFUNCTION; return yyTok;}
"url("{w}{string}{w}")" {yyTok = URI; return yyTok;}
"url("{w}{url}{w}")" {yyTok = URI; return yyTok;}
-"-webkit-var("{w}{ident}{w}")" { yyTok = VARCALL; return yyTok; }
{ident}"(" {yyTok = FUNCTION; return yyTok;}
U\+{range} {yyTok = UNICODERANGE; return yyTok;}