diff options
| author | Ben Murdoch <benm@google.com> | 2010-05-11 18:35:50 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-05-14 10:23:05 +0100 |
| commit | 21939df44de1705786c545cd1bf519d47250322d (patch) | |
| tree | ef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebCore/css | |
| parent | 4ff1d8891d520763f17675827154340c7c740f90 (diff) | |
| download | external_webkit-21939df44de1705786c545cd1bf519d47250322d.zip external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2 | |
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebCore/css')
33 files changed, 665 insertions, 170 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index d7f585f..86756b7 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -1474,6 +1474,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper break; /* Other unimplemented properties */ + case CSSPropertyBackgroundRepeatX: + case CSSPropertyBackgroundRepeatY: case CSSPropertyContent: // FIXME: needs implementation, bug 23668 case CSSPropertyCounterIncrement: case CSSPropertyCounterReset: @@ -1494,6 +1496,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitMarquee: case CSSPropertyWebkitMarqueeSpeed: case CSSPropertyWebkitMask: + case CSSPropertyWebkitMaskRepeatX: + case CSSPropertyWebkitMaskRepeatY: case CSSPropertyWebkitPaddingStart: case CSSPropertyWebkitPerspectiveOriginX: case CSSPropertyWebkitPerspectiveOriginY: @@ -1546,7 +1550,7 @@ void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& ec = NO_MODIFICATION_ALLOWED_ERR; } -unsigned CSSComputedStyleDeclaration::length() const +unsigned CSSComputedStyleDeclaration::virtualLength() const { Node* node = m_node.get(); if (!node) diff --git a/WebCore/css/CSSComputedStyleDeclaration.h b/WebCore/css/CSSComputedStyleDeclaration.h index eb93bad..ba55d77 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.h +++ b/WebCore/css/CSSComputedStyleDeclaration.h @@ -39,7 +39,7 @@ public: virtual String cssText() const; - virtual unsigned length() const; + virtual unsigned virtualLength() const; virtual String item(unsigned index) const; virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const; diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp index 308ff31..21eea04 100644 --- a/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/WebCore/css/CSSFontFaceSrcValue.cpp @@ -49,6 +49,9 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const } return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype") +#if ENABLE(OPENTYPE_SANITIZER) + || equalIgnoringCase(m_format, "woff") +#endif #if ENABLE(SVG_FONTS) || isSVGFontFaceSrc() #endif diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y index ec0c141..7798264 100644 --- a/WebCore/css/CSSGrammar.y +++ b/WebCore/css/CSSGrammar.y @@ -70,6 +70,7 @@ using namespace HTMLNames; CSSRuleList* ruleList; CSSSelector* selector; Vector<CSSSelector*>* selectorList; + CSSSelector::MarginBoxType marginBox; CSSSelector::Relation relation; MediaList* mediaList; MediaQuery* mediaQuery; @@ -97,7 +98,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %} -%expect 54 +%expect 55 %nonassoc LOWEST_PREC @@ -142,6 +143,23 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %token WEBKIT_DEFINE_SYM %token VARIABLES_FOR %token WEBKIT_VARIABLES_DECLS_SYM +%token <marginBox> TOPLEFTCORNER_SYM +%token <marginBox> TOPLEFT_SYM +%token <marginBox> TOPCENTER_SYM +%token <marginBox> TOPRIGHT_SYM +%token <marginBox> TOPRIGHTCORNER_SYM +%token <marginBox> BOTTOMLEFTCORNER_SYM +%token <marginBox> BOTTOMLEFT_SYM +%token <marginBox> BOTTOMCENTER_SYM +%token <marginBox> BOTTOMRIGHT_SYM +%token <marginBox> BOTTOMRIGHTCORNER_SYM +%token <marginBox> LEFTTOP_SYM +%token <marginBox> LEFTMIDDLE_SYM +%token <marginBox> LEFTBOTTOM_SYM +%token <marginBox> RIGHTTOP_SYM +%token <marginBox> RIGHTMIDDLE_SYM +%token <marginBox> RIGHTBOTTOM_SYM + %token ATKEYWORD %token IMPORTANT_SYM @@ -188,6 +206,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <rule> import %type <rule> namespace %type <rule> page +%type <rule> margin_box %type <rule> font_face %type <rule> keyframes %type <rule> invalid_rule @@ -209,6 +228,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <string> ident_or_string %type <string> medium %type <string> hexcolor +%type <marginBox> margin_sym %type <string> media_feature %type <mediaList> media_list @@ -237,10 +257,12 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <selector> class %type <selector> attrib %type <selector> pseudo +%type <selector> page_selector %type <boolean> declaration_list %type <boolean> decl_list %type <boolean> declaration +%type <boolean> declarations_and_margins %type <boolean> prio @@ -729,26 +751,105 @@ key: } ; -/* page: - PAGE_SYM maybe_space IDENT? pseudo_page? maybe_space - '{' maybe_space declaration [ ';' maybe_space declaration ]* '}' maybe_space - ; - -pseudo_page - : ':' IDENT - ; -*/ - -page: - PAGE_SYM error invalid_block { + PAGE_SYM maybe_space page_selector maybe_space + '{' maybe_space declarations_and_margins closing_brace { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createPageRule(p->sinkFloatingSelector($3)); + } + | PAGE_SYM error invalid_block { $$ = 0; } - | PAGE_SYM error ';' { + | PAGE_SYM error ';' { $$ = 0; } ; +page_selector: + IDENT { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelector(); + $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + } + | IDENT pseudo { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = $2; + if ($$) + $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + } + | pseudo { + $$ = $1; + } + | /* empty */ { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelector(); + } + ; + +declarations_and_margins: + declaration_list + | declarations_and_margins margin_box maybe_space declaration_list + ; + +margin_box: + margin_sym { + static_cast<CSSParser*>(parser)->startDeclarationsForMarginBox(); + } maybe_space '{' maybe_space declaration_list closing_brace { + $$ = static_cast<CSSParser*>(parser)->createMarginAtRule($1); + } + ; + +margin_sym : + TOPLEFTCORNER_SYM { + $$ = CSSSelector::TopLeftCornerMarginBox; + } + | TOPLEFT_SYM { + $$ = CSSSelector::TopLeftMarginBox; + } + | TOPCENTER_SYM { + $$ = CSSSelector::TopCenterMarginBox; + } + | TOPRIGHT_SYM { + $$ = CSSSelector::TopRightMarginBox; + } + | TOPRIGHTCORNER_SYM { + $$ = CSSSelector::TopRightCornerMarginBox; + } + | BOTTOMLEFTCORNER_SYM { + $$ = CSSSelector::BottomLeftCornerMarginBox; + } + | BOTTOMLEFT_SYM { + $$ = CSSSelector::BottomLeftMarginBox; + } + | BOTTOMCENTER_SYM { + $$ = CSSSelector::BottomCenterMarginBox; + } + | BOTTOMRIGHT_SYM { + $$ = CSSSelector::BottomRightMarginBox; + } + | BOTTOMRIGHTCORNER_SYM { + $$ = CSSSelector::BottomRightCornerMarginBox; + } + | LEFTTOP_SYM { + $$ = CSSSelector::LeftTopMarginBox; + } + | LEFTMIDDLE_SYM { + $$ = CSSSelector::LeftMiddleMarginBox; + } + | LEFTBOTTOM_SYM { + $$ = CSSSelector::LeftBottomMarginBox; + } + | RIGHTTOP_SYM { + $$ = CSSSelector::RightTopMarginBox; + } + | RIGHTMIDDLE_SYM { + $$ = CSSSelector::RightMiddleMarginBox; + } + | RIGHTBOTTOM_SYM { + $$ = CSSSelector::RightBottomMarginBox; + } + ; + font_face: FONT_FACE_SYM maybe_space '{' maybe_space declaration_list '}' maybe_space { diff --git a/WebCore/css/CSSHelper.cpp b/WebCore/css/CSSHelper.cpp index 8e6f3a0..c3418b4 100644 --- a/WebCore/css/CSSHelper.cpp +++ b/WebCore/css/CSSHelper.cpp @@ -36,7 +36,7 @@ String deprecatedParseURL(const String& url) int o = 0; int l = i->length(); - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } @@ -53,7 +53,7 @@ String deprecatedParseURL(const String& url) l -= 5; } - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } @@ -65,7 +65,7 @@ String deprecatedParseURL(const String& url) l -= 2; } - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 31c7507..327f398 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -627,9 +627,9 @@ void CSSMutableStyleDeclaration::setLengthProperty(int propertyId, const String& setStrictParsing(parseMode); } -unsigned CSSMutableStyleDeclaration::length() const +unsigned CSSMutableStyleDeclaration::virtualLength() const { - return m_properties.size(); + return length(); } String CSSMutableStyleDeclaration::item(unsigned i) const diff --git a/WebCore/css/CSSMutableStyleDeclaration.h b/WebCore/css/CSSMutableStyleDeclaration.h index 5eb8a27..f7759f4 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.h +++ b/WebCore/css/CSSMutableStyleDeclaration.h @@ -88,7 +88,9 @@ public: virtual String cssText() const; virtual void setCssText(const String&, ExceptionCode&); - virtual unsigned length() const; + virtual unsigned virtualLength() const; + unsigned length() const { return m_properties.size(); } + virtual String item(unsigned index) const; virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const; diff --git a/WebCore/css/CSSPageRule.cpp b/WebCore/css/CSSPageRule.cpp index 6a37963..c85c1aa 100644 --- a/WebCore/css/CSSPageRule.cpp +++ b/WebCore/css/CSSPageRule.cpp @@ -23,12 +23,16 @@ #include "CSSPageRule.h" #include "CSSMutableStyleDeclaration.h" +#include <wtf/Vector.h> namespace WebCore { -CSSPageRule::CSSPageRule(CSSStyleSheet* parent) - : CSSRule(parent) +CSSPageRule::CSSPageRule(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine) + : CSSStyleRule(parent, sourceLine) { + Vector<CSSSelector*> selectors; + selectors.append(selector); + adoptSelectorVector(selectors); } CSSPageRule::~CSSPageRule() @@ -37,19 +41,14 @@ CSSPageRule::~CSSPageRule() String CSSPageRule::selectorText() const { - // FIXME: Implement! - return String(); -} - -void CSSPageRule::setSelectorText(const String& /*selectorText*/, ExceptionCode& /*ec*/) -{ - // FIXME: Implement! -} - -String CSSPageRule::cssText() const -{ - // FIXME: Implement! - return String(); + String text = "@page"; + CSSSelector* selector = selectorList().first(); + if (selector) { + String pageSpecification = selector->selectorText(); + if (!pageSpecification.isEmpty() && pageSpecification != starAtom) + text += " " + pageSpecification; + } + return text; } } // namespace WebCore diff --git a/WebCore/css/CSSPageRule.h b/WebCore/css/CSSPageRule.h index 8e374a5..bdfb751 100644 --- a/WebCore/css/CSSPageRule.h +++ b/WebCore/css/CSSPageRule.h @@ -22,37 +22,34 @@ #ifndef CSSPageRule_h #define CSSPageRule_h -#include "CSSRule.h" +#include "CSSStyleRule.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { class CSSMutableStyleDeclaration; +class CSSSelector; +class CSSSelectorList; -class CSSPageRule : public CSSRule { +class CSSPageRule : public CSSStyleRule { public: - static PassRefPtr<CSSPageRule> create(CSSStyleSheet* parent) + static PassRefPtr<CSSPageRule> create(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine) { - return adoptRef(new CSSPageRule(parent)); + return adoptRef(new CSSPageRule(parent, selector, sourceLine)); } virtual ~CSSPageRule(); - String selectorText() const; - void setSelectorText(const String&, ExceptionCode&); - - CSSMutableStyleDeclaration* style() const { return m_style.get(); } - - virtual String cssText() const; + virtual String selectorText() const; private: - CSSPageRule(CSSStyleSheet* parent); + CSSPageRule(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine); + + virtual bool isPageRule() { return true; } // Inherited from CSSRule virtual unsigned short type() const { return PAGE_RULE; } - - RefPtr<CSSMutableStyleDeclaration> m_style; }; } // namespace WebCore diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 466e741..8983eeb 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -40,6 +40,7 @@ #include "CSSInitialValue.h" #include "CSSMediaRule.h" #include "CSSMutableStyleDeclaration.h" +#include "CSSPageRule.h" #include "CSSPrimitiveValue.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" @@ -69,6 +70,7 @@ #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSTransformValue.h" +#include <limits.h> #include <wtf/dtoa.h> #if ENABLE(DASHBOARD_SUPPORT) @@ -95,6 +97,8 @@ using namespace WTF; namespace WebCore { +static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; + static bool equal(const CSSParserString& a, const char* b) { for (int i = 0; i < a.length; ++i) { @@ -139,6 +143,7 @@ CSSParser::CSSParser(bool strictParsing) , m_parsedProperties(static_cast<CSSProperty**>(fastMalloc(32 * sizeof(CSSProperty*)))) , m_numParsedProperties(0) , m_maxParsedProperties(32) + , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) , m_inParseShorthand(0) , m_currentShorthand(0) , m_implicitShorthand(false) @@ -448,6 +453,7 @@ void CSSParser::clearProperties() for (unsigned i = 0; i < m_numParsedProperties; i++) delete m_parsedProperties[i]; m_numParsedProperties = 0; + m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; m_hasFontFaceOnlyValues = false; } @@ -638,7 +644,9 @@ bool CSSParser::parseValue(int propId, bool important) * (see parseAuralValues). As we don't support them at all this seems reasonable. */ - case CSSPropertySize: // <length>{1,2} | auto | portrait | landscape | inherit + case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] + return parseSize(propId, important); + case CSSPropertyQuotes: // [<string> <string>]+ | none | inherit if (id) validPrimitive = true; @@ -1738,18 +1746,28 @@ bool CSSParser::parseValue(int propId, bool important) return parseTransitionShorthand(important); case CSSPropertyInvalid: return false; - case CSSPropertyFontStretch: case CSSPropertyPage: + return parsePage(propId, important); + case CSSPropertyFontStretch: case CSSPropertyTextLineThrough: case CSSPropertyTextOverline: case CSSPropertyTextUnderline: case CSSPropertyWebkitVariableDeclarationBlock: return false; +<<<<<<< HEAD:WebCore/css/CSSParser.cpp #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: parsedValue = parseColor(); if (parsedValue) m_valueList->next(); +======= +#if ENABLE(WCSS) + case CSSPropertyWapInputFormat: + validPrimitive = true; + break; + case CSSPropertyWapInputRequired: + parsedValue = parseWCSSInputProperty(); +>>>>>>> webkit.org at r58956:WebCore/css/CSSParser.cpp break; #endif @@ -1781,6 +1799,27 @@ bool CSSParser::parseValue(int propId, bool important) return false; } +#if ENABLE(WCSS) +PassRefPtr<CSSValue> CSSParser::parseWCSSInputProperty() +{ + RefPtr<CSSValue> parsedValue = 0; + CSSParserValue* value = m_valueList->current(); + String inputProperty; + if (value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPrimitiveValue::CSS_IDENT) + inputProperty = String(value->string); + + if (!inputProperty.isEmpty()) + parsedValue = CSSPrimitiveValue::create(inputProperty, CSSPrimitiveValue::CSS_STRING); + + while (m_valueList->next()) { + // pass all other values, if any. If we don't do this, + // the parser will think that it's not done and won't process this property + } + + return parsedValue; +} +#endif + void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval) { if (lval) { @@ -2164,6 +2203,101 @@ bool CSSParser::parse4Values(int propId, const int *properties, bool important) return true; } +// auto | <identifier> +bool CSSParser::parsePage(int propId, bool important) +{ + ASSERT(propId == CSSPropertyPage); + + if (m_valueList->size() != 1) + return false; + + CSSParserValue* value = m_valueList->current(); + if (!value) + return false; + + if (value->id == CSSValueAuto) { + addProperty(propId, CSSPrimitiveValue::createIdentifier(value->id), important); + return true; + } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { + addProperty(propId, CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_STRING), important); + return true; + } + return false; +} + +// <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] +bool CSSParser::parseSize(int propId, bool important) +{ + ASSERT(propId == CSSPropertySize); + + if (m_valueList->size() > 2) + return false; + + CSSParserValue* value = m_valueList->current(); + if (!value) + return false; + + RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated(); + + // First parameter. + SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None); + if (paramType == None) + return false; + + // Second parameter, if any. + value = m_valueList->next(); + if (value) { + paramType = parseSizeParameter(parsedValues.get(), value, paramType); + if (paramType == None) + return false; + } + + addProperty(propId, parsedValues.release(), important); + return true; +} + +CSSParser::SizeParameterType CSSParser::parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType) +{ + switch (value->id) { + case CSSValueAuto: + if (prevParamType == None) { + parsedValues->append(CSSPrimitiveValue::createIdentifier(value->id)); + return Auto; + } + return None; + case CSSValueLandscape: + case CSSValuePortrait: + if (prevParamType == None || prevParamType == PageSize) { + parsedValues->append(CSSPrimitiveValue::createIdentifier(value->id)); + return Orientation; + } + return None; + case CSSValueA3: + case CSSValueA4: + case CSSValueA5: + case CSSValueB4: + case CSSValueB5: + case CSSValueLedger: + case CSSValueLegal: + case CSSValueLetter: + if (prevParamType == None || prevParamType == Orientation) { + // Normalize to Page Size then Orientation order by prepending. + // This is not specified by the CSS3 Paged Media specification, but for simpler processing hereafter. + parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id)); + return PageSize; + } + return None; + case 0: + if (validUnit(value, FLength, m_strict) && (prevParamType == None || prevParamType == Length)) { + parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit))); + return Length; + } + return None; + default: + return None; + } +} + // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit // in CSS 2.1 this got somewhat reduced: // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit @@ -5253,6 +5387,43 @@ bool CSSParser::addVariableDeclarationBlock(const CSSParserString&) #endif +CSSRule* CSSParser::createPageRule(CSSSelector* pageSelector) +{ + // FIXME: Margin at-rules are ignored. + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; + CSSPageRule* pageRule = 0; + if (pageSelector) { + RefPtr<CSSPageRule> rule = CSSPageRule::create(m_styleSheet, pageSelector, m_lastSelectorLine); + rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties)); + pageRule = rule.get(); + m_parsedStyleObjects.append(rule.release()); + } + clearProperties(); + return pageRule; +} + +CSSRule* CSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */) +{ + // FIXME: Implement margin at-rule here, using: + // - marginBox: margin box + // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMarginBox, m_numParsedProperties) are for this at-rule. + + endDeclarationsForMarginBox(); + return 0; // until this method is implemented. +} + +void CSSParser::startDeclarationsForMarginBox() +{ + m_numParsedPropertiesBeforeMarginBox = m_numParsedProperties; +} + +void CSSParser::endDeclarationsForMarginBox() +{ + ASSERT(m_numParsedPropertiesBeforeMarginBox != INVALID_NUM_PARSED_PROPERTIES); + rollbackLastProperties(m_numParsedProperties - m_numParsedPropertiesBeforeMarginBox); + m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; +} + void CSSParser::clearVariables() { m_variableNames.clear(); diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index ca8c66a..6e0354e 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -2,6 +2,7 @@ * Copyright (C) 2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -139,6 +140,10 @@ namespace WebCore { PassRefPtr<CSSValue> parseSVGStrokeDasharray(); #endif +#if ENABLE(WCSS) + PassRefPtr<CSSValue> parseWCSSInputProperty(); +#endif + // CSS3 Parsing Routines (for properties specific to CSS3) bool parseShadow(int propId, bool important); bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&); @@ -179,6 +184,10 @@ namespace WebCore { CSSRule* createStyleRule(Vector<CSSSelector*>* selectors); CSSRule* createFontFaceRule(); CSSRule* createVariablesRule(MediaList*, bool variablesKeyword); + CSSRule* createPageRule(CSSSelector* pageSelector); + CSSRule* createMarginAtRule(CSSSelector::MarginBoxType marginBox); + void startDeclarationsForMarginBox(); + void endDeclarationsForMarginBox(); MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*); MediaQueryExp* sinkFloatingMediaQueryExp(MediaQueryExp*); @@ -212,6 +221,7 @@ namespace WebCore { CSSSelectorList* m_selectorListForParseSelector; unsigned m_numParsedProperties; unsigned m_maxParsedProperties; + unsigned m_numParsedPropertiesBeforeMarginBox; int m_inParseShorthand; int m_currentShorthand; @@ -247,6 +257,18 @@ namespace WebCore { void deleteFontFaceOnlyValues(); + enum SizeParameterType { + None, + Auto, + Length, + PageSize, + Orientation, + }; + + bool parsePage(int propId, bool important); + bool parseSize(int propId, bool important); + SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType); + UChar* m_data; UChar* yytext; UChar* yy_c_buf_p; diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 223b515..d5876e7 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -276,10 +276,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) m_value.ident = CSSValueOuterSpinButton; break; case ProgressBarPart: -#if ENABLE(PROGRESS_BAR) +#if ENABLE(PROGRESS_TAG) m_value.ident = CSSValueProgressBar; #endif break; + case ProgressBarValuePart: +#if ENABLE(PROGRESS_TAG) + m_value.ident = CSSValueProgressBarValue; +#endif + break; case SliderHorizontalPart: m_value.ident = CSSValueSliderHorizontal; break; diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index aed7063..6ed923a 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -8,6 +8,24 @@ # http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp # +# high-priority property names have to be listed first, to simplify the check +# for applying them first. +color +direction +display +font +font-family +font-size +font-style +font-variant +font-weight +-webkit-text-size-adjust +zoom + +# line height needs to be right after the above high-priority properties +line-height + +# The remaining properties are listed in alphabetical order background background-attachment background-clip @@ -52,26 +70,16 @@ bottom caption-side clear clip -color content counter-increment counter-reset cursor -direction -display empty-cells float -font -font-family -font-size font-stretch -font-style -font-variant -font-weight height left letter-spacing -line-height list-style list-style-image list-style-position @@ -146,7 +154,6 @@ word-break word-spacing word-wrap z-index -zoom -webkit-animation -webkit-animation-delay -webkit-animation-direction @@ -241,7 +248,6 @@ zoom -webkit-text-decorations-in-effect -webkit-text-fill-color -webkit-text-security --webkit-text-size-adjust -webkit-text-stroke -webkit-text-stroke-color -webkit-text-stroke-width diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 23a89f6..ee9c846 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -143,6 +143,13 @@ PseudoId CSSSelector::pseudoId(PseudoType type) return INNER_SPIN_BUTTON; case PseudoOuterSpinButton: return OUTER_SPIN_BUTTON; + case PseudoProgressBarValue: +#if ENABLE(PROGRESS_TAG) + return PROGRESS_BAR_VALUE; +#else + ASSERT_NOT_REACHED(); + return NOPSEUDO; +#endif case PseudoInputListButton: #if ENABLE(DATALIST) return INPUT_LIST_BUTTON; @@ -196,6 +203,9 @@ PseudoId CSSSelector::pseudoId(PseudoType type) case PseudoDoubleButton: case PseudoSingleButton: case PseudoNoButton: + case PseudoFirstPage: + case PseudoLeftPage: + case PseudoRightPage: return NOPSEUDO; case PseudoNotParsed: ASSERT_NOT_REACHED(); @@ -267,8 +277,8 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button")); -#if ENABLE(PROGRESS_BAR) - DEFINE_STATIC_LOCAL(AtomicString, progressBar, ("-webkit-progress-bar")); +#if ENABLE(PROGRESS_TAG) + DEFINE_STATIC_LOCAL(AtomicString, progressBarValue, ("-webkit-progress-bar-value")); #endif DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); @@ -298,6 +308,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button")); DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button")); DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present")); + // Paged Media pseudo-classes + DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first")); + DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left")); + DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right")); static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0; if (!nameToPseudoType) { @@ -360,6 +374,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChild); nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType); nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton); +#if ENABLE(PROGRESS_TAG) + nameToPseudoType->set(progressBarValue.impl(), CSSSelector::PseudoProgressBarValue); +#endif nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); nameToPseudoType->set(decrement.impl(), CSSSelector::PseudoDecrement); @@ -389,6 +406,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(sliderThumb.impl(), CSSSelector::PseudoSliderThumb); nameToPseudoType->set(target.impl(), CSSSelector::PseudoTarget); nameToPseudoType->set(visited.impl(), CSSSelector::PseudoVisited); + nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage); + nameToPseudoType->set(leftPage.impl(), CSSSelector::PseudoLeftPage); + nameToPseudoType->set(rightPage.impl(), CSSSelector::PseudoRightPage); } return nameToPseudoType; } @@ -439,6 +459,7 @@ void CSSSelector::extractPseudoType() const case PseudoMediaControlsTimelineContainer: case PseudoMediaControlsVolumeSliderContainer: case PseudoOuterSpinButton: + case PseudoProgressBarValue: case PseudoResizer: case PseudoScrollbar: case PseudoScrollbarCorner: @@ -505,6 +526,12 @@ void CSSSelector::extractPseudoType() const case PseudoNoButton: case PseudoNotParsed: break; + case PseudoFirstPage: + case PseudoLeftPage: + case PseudoRightPage: + // FIXME: These should only be allowed in @page rules. Disabled them altogether until that's implemented correctly. + m_pseudoType = PseudoUnknown; + return; } if (m_match == PseudoClass && element) { @@ -749,7 +776,8 @@ bool CSSSelector::RareData::parseNth() m_b = argument.substring(p + 1, argument.length() - p - 1).toInt(); else { p = argument.find('-', n); - m_b = -argument.substring(p + 1, argument.length() - p - 1).toInt(); + if (p != -1) + m_b = -argument.substring(p + 1, argument.length() - p - 1).toInt(); } } else m_b = argument.toInt(); diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index f8748c7..8f84b05 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -187,6 +187,29 @@ namespace WebCore { PseudoInputListButton, PseudoInnerSpinButton, PseudoOuterSpinButton, + PseudoProgressBarValue, + PseudoLeftPage, + PseudoRightPage, + PseudoFirstPage, + }; + + enum MarginBoxType { + TopLeftCornerMarginBox, + TopLeftMarginBox, + TopCenterMarginBox, + TopRightMarginBox, + TopRightCornerMarginBox, + BottomLeftCornerMarginBox, + BottomLeftMarginBox, + BottomCenterMarginBox, + BottomRightMarginBox, + BottomRightCornerMarginBox, + LeftTopMarginBox, + LeftMiddleMarginBox, + LeftBottomMarginBox, + RightTopMarginBox, + RightMiddleMarginBox, + RightBottomMarginBox, }; PseudoType pseudoType() const diff --git a/WebCore/css/CSSStyleDeclaration.h b/WebCore/css/CSSStyleDeclaration.h index 18493df..08b3bf0 100644 --- a/WebCore/css/CSSStyleDeclaration.h +++ b/WebCore/css/CSSStyleDeclaration.h @@ -42,7 +42,8 @@ public: virtual String cssText() const = 0; virtual void setCssText(const String&, ExceptionCode&) = 0; - virtual unsigned length() const = 0; + unsigned length() const { return virtualLength(); } + virtual unsigned virtualLength() const = 0; bool isEmpty() const { return !length(); } virtual String item(unsigned index) const = 0; diff --git a/WebCore/css/CSSStyleRule.h b/WebCore/css/CSSStyleRule.h index 835f2a2..d797c73 100644 --- a/WebCore/css/CSSStyleRule.h +++ b/WebCore/css/CSSStyleRule.h @@ -40,7 +40,7 @@ public: } virtual ~CSSStyleRule(); - String selectorText() const; + virtual String selectorText() const; void setSelectorText(const String&, ExceptionCode&); CSSMutableStyleDeclaration* style() const { return m_style.get(); } @@ -60,9 +60,10 @@ public: int sourceLine() { return m_sourceLine; } -private: +protected: CSSStyleRule(CSSStyleSheet* parent, int sourceLine); +private: virtual bool isStyleRule() { return true; } // Inherited from CSSRule diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index dd4fed9..389bd11 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -31,6 +31,7 @@ #include "CSSFontFaceRule.h" #include "CSSImportRule.h" #include "CSSMediaRule.h" +#include "CSSPageRule.h" #include "CSSParser.h" #include "CSSPrimitiveValueMappings.h" #include "CSSPropertyNames.h" @@ -358,6 +359,7 @@ public: void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0); void addRule(CSSStyleRule* rule, CSSSelector* sel); + void addPageRule(CSSStyleRule* rule, CSSSelector* sel); void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, CSSStyleRule* rule, CSSSelector* sel); @@ -365,13 +367,16 @@ public: CSSRuleDataList* getClassRules(AtomicStringImpl* key) { return m_classRules.get(key); } CSSRuleDataList* getTagRules(AtomicStringImpl* key) { return m_tagRules.get(key); } CSSRuleDataList* getUniversalRules() { return m_universalRules; } + CSSRuleDataList* getPageRules() { return m_pageRules; } public: AtomRuleMap m_idRules; AtomRuleMap m_classRules; AtomRuleMap m_tagRules; CSSRuleDataList* m_universalRules; + CSSRuleDataList* m_pageRules; unsigned m_ruleCount; + unsigned m_pageRuleCount; }; static CSSRuleSet* defaultStyle; @@ -486,6 +491,7 @@ void CSSStyleSelector::addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule) void CSSStyleSelector::init() { m_element = 0; + m_haveCachedLinkState = false; m_matchedDecls.clear(); m_ruleList = 0; m_rootDefaultStyle = 0; @@ -696,9 +702,7 @@ void CSSStyleSelector::matchRulesForList(CSSRuleDataList* rules, int& firstRuleI for (CSSRuleData* d = rules->first(); d; d = d->next()) { CSSStyleRule* rule = d->rule(); - const AtomicString& localName = m_element->localName(); - const AtomicString& selectorLocalName = d->selector()->m_tag.localName(); - if ((localName == selectorLocalName || selectorLocalName == starAtom) && checkSelector(d->selector())) { + if (checkSelector(d->selector())) { // If the rule has no properties to apply, then ignore it. CSSMutableStyleDeclaration* decl = rule->declaration(); if (!decl || !decl->length()) @@ -800,13 +804,16 @@ void CSSStyleSelector::sortMatchedRules(unsigned start, unsigned end) m_matchedRules[i] = rulesMergeBuffer[i - start]; } -void CSSStyleSelector::initElement(Element* e) +inline void CSSStyleSelector::initElement(Element* e, bool helperCallForVisitedStyle = false) { + if (!helperCallForVisitedStyle) + m_haveCachedLinkState = false; + m_element = e; m_styledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0; } -void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID) +inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID) { m_checker.m_pseudoStyle = pseudoID; @@ -874,10 +881,17 @@ CSSStyleSelector::SelectorChecker::SelectorChecker(Document* document, bool stri { } -EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const +inline EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const { if (!element->isLink()) return NotInsideLink; + return determineLinkStateSlowCase(element); +} + + +EInsideLink CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase(Element* element) const +{ + ASSERT(element->isLink()); const AtomicString* attr = linkAttribute(element); if (!attr || attr->isNull()) @@ -1025,7 +1039,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) mappedAttrsMatch = s->mappedAttributes()->mapsEquivalent(m_styledElement->mappedAttributes()); if (mappedAttrsMatch) { if (s->isLink()) { - if (m_checker.determineLinkState(m_element) != style->insideLink()) + if (currentElementLinkState() != style->insideLink()) return false; } return true; @@ -1036,7 +1050,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) return false; } -RenderStyle* CSSStyleSelector::locateSharedStyle() +ALWAYS_INLINE RenderStyle* CSSStyleSelector::locateSharedStyle() { if (m_styledElement && !m_styledElement->inlineStyleDecl() && !m_styledElement->hasID() && !m_styledElement->document()->usesSiblingRules()) { // Check previous siblings. @@ -1118,13 +1132,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document) // If resolveForRootDefault is true, style based on user agent style sheet only. This is used in media queries, where // relative units are interpreted according to document root element style, styled only with UA stylesheet -PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool matchVisitedRules) +PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle) { // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer // will vanish if a style recalc happens during loading. if (allowSharing && !e->document()->haveStylesheetsLoaded() && !e->renderer()) { if (!s_styleNotYetAvailable) { - s_styleNotYetAvailable = ::new RenderStyle; + s_styleNotYetAvailable = RenderStyle::create().releaseRef(); s_styleNotYetAvailable->ref(); s_styleNotYetAvailable->setDisplay(NONE); s_styleNotYetAvailable->font().update(m_fontSelector); @@ -1134,7 +1148,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl return s_styleNotYetAvailable; } - initElement(e); + initElement(e, helperCallForVisitedStyle); if (allowSharing) { RenderStyle* sharedStyle = locateSharedStyle(); if (sharedStyle) @@ -1144,7 +1158,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl // Compute our style allowing :visited to match first. RefPtr<RenderStyle> visitedStyle; - if (!matchVisitedRules && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) { + if (!helperCallForVisitedStyle && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) { // Fetch our parent style. RenderStyle* parentStyle = m_parentStyle; if (!e->isLink()) { @@ -1158,7 +1172,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl initForStyleResolve(e, defaultParent); } - m_checker.m_matchVisitedPseudoClass = matchVisitedRules; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; m_style = RenderStyle::create(); @@ -1169,7 +1183,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl if (e->isLink()) { m_style->setIsLink(true); - m_style->setInsideLink(m_checker.determineLinkState(e)); + m_style->setInsideLink(currentElementLinkState()); } if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) @@ -1284,19 +1298,19 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } // Reset the value back before applying properties, so that -webkit-link knows what color to use. - m_checker.m_matchVisitedPseudoClass = matchVisitedRules; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // Now we have all of the matched rules in the appropriate order. Walk the rules and apply // high-priority properties first, i.e., those properties that other properties depend on. // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important // and (4) normal important. m_lineHeightValue = 0; - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); if (!resolveForRootDefault) { - applyDeclarations(true, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(true, true, firstUserRule, lastUserRule); + applyDeclarations<true>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<true>(true, firstUserRule, lastUserRule); } - applyDeclarations(true, true, firstUARule, lastUARule); + applyDeclarations<true>(true, firstUARule, lastUARule); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1307,18 +1321,18 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do the normal priority UA properties. - applyDeclarations(false, false, firstUARule, lastUARule); + applyDeclarations<false>(false, firstUARule, lastUARule); // Cache our border and background so that we can examine them later. cacheBorderAndBackground(); // Now do the author and user normal priority properties and all the !important properties. if (!resolveForRootDefault) { - applyDeclarations(false, false, lastUARule + 1, m_matchedDecls.size() - 1); - applyDeclarations(false, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(false, true, firstUserRule, lastUserRule); + applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1); + applyDeclarations<false>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<false>(true, firstUserRule, lastUserRule); } - applyDeclarations(false, true, firstUARule, lastUARule); + applyDeclarations<false>(true, firstUARule, lastUARule); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -1382,7 +1396,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* // We don't need to bother with !important. Since there is only ever one // decl, there's nothing to override. So just add the first properties. - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1393,7 +1407,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do rest of the properties. - applyDeclarations(false, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -1431,7 +1445,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* list.clear(); } -PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool matchVisitedLinks) +PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool helperCallForVisitedStyle) { if (!e) return 0; @@ -1439,7 +1453,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, // Compute our :visited style first, so that we know whether or not we'll need to create a normal style just to hang it // off of. RefPtr<RenderStyle> visitedStyle; - if (!matchVisitedLinks && parentStyle && parentStyle->insideLink()) { + if (!helperCallForVisitedStyle && parentStyle && parentStyle->insideLink()) { // Fetch our parent style with :visited in effect. RenderStyle* parentVisitedStyle = parentStyle->getCachedPseudoStyle(VISITED_LINK); visitedStyle = pseudoStyleForElement(pseudo, e, parentVisitedStyle ? parentVisitedStyle : parentStyle, true); @@ -1447,11 +1461,11 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, visitedStyle->setStyleType(VISITED_LINK); } - initElement(e); + initElement(e, helperCallForVisitedStyle); initForStyleResolve(e, parentStyle, pseudo); m_style = parentStyle; - m_checker.m_matchVisitedPseudoClass = matchVisitedLinks; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking // those rules. @@ -1477,13 +1491,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, m_lineHeightValue = 0; // Reset the value back before applying properties, so that -webkit-link knows what color to use. - m_checker.m_matchVisitedPseudoClass = matchVisitedLinks; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // High-priority properties. - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); - applyDeclarations(true, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(true, true, firstUserRule, lastUserRule); - applyDeclarations(true, true, firstUARule, lastUARule); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<true>(true, firstUserRule, lastUserRule); + applyDeclarations<true>(true, firstUARule, lastUARule); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1494,15 +1508,15 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do the normal priority properties. - applyDeclarations(false, false, firstUARule, lastUARule); + applyDeclarations<false>(false, firstUARule, lastUARule); // Cache our border and background so that we can examine them later. cacheBorderAndBackground(); - applyDeclarations(false, false, lastUARule + 1, m_matchedDecls.size() - 1); - applyDeclarations(false, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(false, true, firstUserRule, lastUserRule); - applyDeclarations(false, true, firstUARule, lastUARule); + applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1); + applyDeclarations<false>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<false>(true, firstUserRule, lastUserRule); + applyDeclarations<false>(true, firstUARule, lastUARule); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -2540,6 +2554,11 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme break; return true; } + case CSSSelector::PseudoLeftPage: + case CSSSelector::PseudoRightPage: + case CSSSelector::PseudoFirstPage: + // Page media related pseudo-classes are not handled yet. + return false; case CSSSelector::PseudoUnknown: case CSSSelector::PseudoNotParsed: default: @@ -2666,7 +2685,9 @@ CSSValue* CSSStyleSelector::resolveVariableDependentValue(CSSVariableDependentVa CSSRuleSet::CSSRuleSet() { m_universalRules = 0; + m_pageRules = 0; m_ruleCount = 0; + m_pageRuleCount = 0; } CSSRuleSet::~CSSRuleSet() @@ -2676,6 +2697,7 @@ CSSRuleSet::~CSSRuleSet() deleteAllValues(m_tagRules); delete m_universalRules; + delete m_pageRules; } @@ -2715,6 +2737,14 @@ void CSSRuleSet::addRule(CSSStyleRule* rule, CSSSelector* sel) m_universalRules->append(m_ruleCount++, rule, sel); } +void CSSRuleSet::addPageRule(CSSStyleRule* rule, CSSSelector* sel) +{ + if (!m_pageRules) + m_pageRules = new CSSRuleDataList(m_pageRuleCount++, rule, sel); + else + m_pageRules->append(m_pageRuleCount++, rule, sel); +} + void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluator& medium, CSSStyleSelector* styleSelector) { if (!sheet) @@ -2730,9 +2760,14 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat for (int i = 0; i < len; i++) { StyleBase* item = sheet->item(i); if (item->isStyleRule()) { - CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); + if (item->isPageRule()) { + CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); + 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); + } } else if (item->isImportRule()) { CSSImportRule* import = static_cast<CSSImportRule*>(item); @@ -2806,8 +2841,8 @@ static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* st return l; } -void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant, - int startIndex, int endIndex) +template <bool applyFirst> +void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int endIndex) { if (startIndex == -1) return; @@ -2817,35 +2852,26 @@ void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant, CSSMutableStyleDeclaration::const_iterator end = decl->end(); for (CSSMutableStyleDeclaration::const_iterator it = decl->begin(); it != end; ++it) { const CSSProperty& current = *it; - // give special priority to font-xxx, color properties if (isImportant == current.isImportant()) { - bool first; - switch (current.id()) { - case CSSPropertyLineHeight: - m_lineHeightValue = current.value(); - first = !applyFirst; // we apply line-height later - break; - case CSSPropertyColor: - case CSSPropertyDirection: - case CSSPropertyDisplay: - case CSSPropertyFont: - case CSSPropertyFontSize: - case CSSPropertyFontStyle: - case CSSPropertyFontFamily: - case CSSPropertyFontWeight: - case CSSPropertyWebkitTextSizeAdjust: - case CSSPropertyFontVariant: - case CSSPropertyZoom: - // these have to be applied first, because other properties use the computed - // values of these properties. - first = true; - break; - default: - first = false; - break; + int property = current.id(); + + if (applyFirst) { + COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); + COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 10, CSS_zoom_is_end_of_first_prop_range); + COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom); + + // give special priority to font-xxx, color properties, etc + if (property <= CSSPropertyLineHeight) { + // we apply line-height later + if (property == CSSPropertyLineHeight) + m_lineHeightValue = current.value(); + else + applyProperty(current.id(), current.value()); + } + } else { + if (property > CSSPropertyLineHeight) + applyProperty(current.id(), current.value()); } - if (first == applyFirst) - applyProperty(current.id(), current.value()); } } } @@ -5294,6 +5320,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitTextStroke: case CSSPropertyWebkitVariableDeclarationBlock: return; +<<<<<<< HEAD:WebCore/css/CSSStyleSelector.cpp #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: { HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); @@ -5305,6 +5332,25 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } #endif +======= +#if ENABLE(WCSS) + case CSSPropertyWapInputFormat: + if (primitiveValue && m_element->hasTagName(WebCore::inputTag)) { + String mask = primitiveValue->getStringValue(); + static_cast<HTMLInputElement*>(m_element)->setWapInputFormat(mask); + } + return; + + case CSSPropertyWapInputRequired: + if (primitiveValue && m_element->isFormControlElement()) { + HTMLFormControlElement* element = static_cast<HTMLFormControlElement*>(m_element); + bool required = primitiveValue->getStringValue() == "true"; + element->setRequired(required); + } + return; +#endif + +>>>>>>> webkit.org at r58956:WebCore/css/CSSStyleSelector.cpp #if ENABLE(SVG) default: // Try the SVG properties diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index 80a186b..5089686 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -35,6 +35,7 @@ namespace WebCore { class CSSMutableStyleDeclaration; +class CSSPageRule; class CSSPrimitiveValue; class CSSProperty; class CSSFontFace; @@ -85,12 +86,11 @@ public: bool strictParsing, bool matchAuthorAndUserStyles); ~CSSStyleSelector(); - void initElement(Element*); void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); - PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false, bool matchVisitedLinks = false); + PassRefPtr<RenderStyle> styleForElement(Element* e, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false) { return styleForElement(e, parentStyle, allowSharing, resolveForRootDefault, false); } void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list); - PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0, bool matchVisitedLinks = false); + PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle = 0) { return pseudoStyleForElement(pseudo, e, parentStyle, false); } static PassRefPtr<RenderStyle> styleForDocument(Document*); @@ -101,6 +101,9 @@ public: #endif private: + PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle); + PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle*, bool helperCallForVisitedStyle); + void initElement(Element*, bool); RenderStyle* locateSharedStyle(); Node* locateCousinList(Element* parent, unsigned depth = 1); bool canShareStyleWithElement(Node*); @@ -155,6 +158,7 @@ public: void resolveVariablesForDeclaration(CSSMutableStyleDeclaration* decl, CSSMutableStyleDeclaration* newDecl, HashSet<String>& usedBlockVariables); void addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule); + void addPageStyle(PassRefPtr<CSSPageRule>); static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations); @@ -175,7 +179,8 @@ public: void matchRulesForList(CSSRuleDataList*, int& firstRuleIndex, int& lastRuleIndex); void sortMatchedRules(unsigned start, unsigned end); - void applyDeclarations(bool firstPass, bool important, int startIndex, int endIndex); + template <bool firstPass> + void applyDeclarations(bool important, int startIndex, int endIndex); CSSRuleSet* m_authorStyle; CSSRuleSet* m_userStyle; @@ -201,6 +206,7 @@ public: bool checkScrollbarPseudoClass(CSSSelector*, PseudoId& dynamicPseudo) const; EInsideLink determineLinkState(Element* element) const; + EInsideLink determineLinkStateSlowCase(Element* element) const; void allVisitedStateChanged(); void visitedStateChanged(LinkHash visitedHash); @@ -252,6 +258,19 @@ public: StyleImage* styleImage(CSSValue* value); + + EInsideLink currentElementLinkState() const + { + if (!m_haveCachedLinkState) { + m_cachedLinkState = m_checker.determineLinkState(m_element); + m_haveCachedLinkState = true; + } + return m_cachedLinkState; + } + + mutable EInsideLink m_cachedLinkState; + mutable bool m_haveCachedLinkState; + // We collect the set of decls that match in |m_matchedDecls|. We then walk the // set of matched decls four times, once for those properties that others depend on (like font-size), // and then a second time for all the remaining properties. We then do the same two passes @@ -347,7 +366,7 @@ public: CSSRuleData* m_first; CSSRuleData* m_last; }; - + } // namespace WebCore #endif // CSSStyleSelector_h diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index fb25374..5949f96 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -28,7 +28,9 @@ #include "Document.h" #include "ExceptionCode.h" #include "Node.h" +#include "Page.h" #include "SecurityOrigin.h" +#include "Settings.h" #include "TextEncoding.h" #include <wtf/Deque.h> @@ -137,8 +139,23 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules) { - if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) - return 0; + if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) { + + // The Safari welcome page runs afoul of the same-origin restriction on access to stylesheet rules + // that was added to address <https://bugs.webkit.org/show_bug.cgi?id=20527>. The following site- + // specific quirk relaxes this restriction for the particular cross-origin access that occurs on + // the Safari welcome page (<rdar://problem/7847573>). + + Settings* settings = doc()->settings(); + if (!settings || !settings->needsSiteSpecificQuirks()) + return 0; + + if (!equalIgnoringCase(baseURL().string(), "http://images.apple.com/safari/welcome/styles/safari.css")) + return 0; + + if (!doc()->url().string().contains("apple.com/safari/welcome/", false)) + return 0; + } return CSSRuleList::create(this, omitCharsetRules); } diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index 09d969a..06d966c 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -380,10 +380,15 @@ collapse # # Unordered rest # +a3 +a4 +a5 above absolute always avoid +b4 +b5 below bidi-override blink @@ -398,6 +403,9 @@ hide higher invert landscape +ledger +legal +letter level line-through local @@ -583,6 +591,7 @@ menulist-text menulist-textfield outer-spin-button progress-bar +progress-bar-value slider-horizontal slider-vertical sliderthumb-horizontal @@ -711,7 +720,8 @@ geometricPrecision sRGB # (-webkit-view-mode:) media feature: -mini floating -application fullscreen +maximized +minimized +windowed diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index ded40b5..20c7bb9 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -533,6 +533,9 @@ bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const if (!m_frame || !m_style) return m_expResult; + if (!expr->isValid()) + return false; + if (!gFunctionMap) createFunctionMap(); diff --git a/WebCore/css/MediaQueryExp.cpp b/WebCore/css/MediaQueryExp.cpp index 7ba6d84..53c0b73 100644 --- a/WebCore/css/MediaQueryExp.cpp +++ b/WebCore/css/MediaQueryExp.cpp @@ -37,6 +37,7 @@ namespace WebCore { MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* valueList) : m_mediaFeature(mediaFeature) , m_value(0) + , m_isValid(true) { if (valueList) { if (valueList->size() == 1) { @@ -73,6 +74,7 @@ MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueLis if (isValid) m_value = list.release(); } + m_isValid = m_value; } } diff --git a/WebCore/css/MediaQueryExp.h b/WebCore/css/MediaQueryExp.h index fd55cf6..9272402 100644 --- a/WebCore/css/MediaQueryExp.h +++ b/WebCore/css/MediaQueryExp.h @@ -52,6 +52,8 @@ public: || (other.m_value && m_value && other.m_value->cssText() == m_value->cssText())); } + bool isValid() const { return m_isValid; } + bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature || m_mediaFeature == MediaFeatureNames::heightMediaFeature || m_mediaFeature == MediaFeatureNames::min_widthMediaFeature || @@ -65,6 +67,7 @@ public: private: AtomicString m_mediaFeature; RefPtr<CSSValue> m_value; + bool m_isValid; }; } // namespace diff --git a/WebCore/css/StyleBase.h b/WebCore/css/StyleBase.h index 5f9124d..521ee5d 100644 --- a/WebCore/css/StyleBase.h +++ b/WebCore/css/StyleBase.h @@ -54,6 +54,7 @@ namespace WebCore { 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; } virtual bool isStyleRule() { return false; } diff --git a/WebCore/css/Media.cpp b/WebCore/css/StyleMedia.cpp index e238602..6cb662f 100644 --- a/WebCore/css/Media.cpp +++ b/WebCore/css/StyleMedia.cpp @@ -24,8 +24,8 @@ */ #include "config.h" +#include "StyleMedia.h" -#include "Media.h" #include "CSSStyleSelector.h" #include "Frame.h" #include "FrameView.h" @@ -34,12 +34,12 @@ namespace WebCore { -Media::Media(Frame* frame) +StyleMedia::StyleMedia(Frame* frame) : m_frame(frame) { } -String Media::type() const +String StyleMedia::type() const { FrameView* view = m_frame ? m_frame->view() : 0; if (view) @@ -48,7 +48,7 @@ String Media::type() const return String(); } -bool Media::matchMedium(const String& query) const +bool StyleMedia::matchMedium(const String& query) const { if (!m_frame) return false; diff --git a/WebCore/css/Media.h b/WebCore/css/StyleMedia.h index ee6961b..761e6a3 100644 --- a/WebCore/css/Media.h +++ b/WebCore/css/StyleMedia.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,18 +24,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Media_h -#define Media_h +#ifndef StyleMedia_h +#define StyleMedia_h #include "DOMWindow.h" namespace WebCore { -class Media : public RefCounted<Media> { +class StyleMedia : public RefCounted<StyleMedia> { public: - static PassRefPtr<Media> create(Frame* frame) + static PassRefPtr<StyleMedia> create(Frame* frame) { - return adoptRef(new Media(frame)); + return adoptRef(new StyleMedia(frame)); } void disconnectFrame() { m_frame = 0; } @@ -42,13 +43,13 @@ public: String type() const; bool matchMedium(const String&) const; - + private: - Media(Frame*); + StyleMedia(Frame*); Frame* m_frame; }; } // namespace -#endif // Media_h +#endif // StyleMedia_h diff --git a/WebCore/css/Media.idl b/WebCore/css/StyleMedia.idl index 1bf5900..7be35cc 100644 --- a/WebCore/css/Media.idl +++ b/WebCore/css/StyleMedia.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,7 +25,7 @@ */ module view { - interface Media { + interface StyleMedia { readonly attribute DOMString type; boolean matchMedium(in DOMString mediaquery); }; diff --git a/WebCore/css/WCSSPropertyNames.in b/WebCore/css/WCSSPropertyNames.in index 704209f..66be83b 100644 --- a/WebCore/css/WCSSPropertyNames.in +++ b/WebCore/css/WCSSPropertyNames.in @@ -1,3 +1,5 @@ +-wap-input-format +-wap-input-required -wap-marquee-dir -wap-marquee-loop -wap-marquee-speed diff --git a/WebCore/css/WebKitCSSMatrix.cpp b/WebCore/css/WebKitCSSMatrix.cpp index aaf5c3d..3714760 100644 --- a/WebCore/css/WebKitCSSMatrix.cpp +++ b/WebCore/css/WebKitCSSMatrix.cpp @@ -93,14 +93,14 @@ void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) ec = SYNTAX_ERR; } -// This is a multRight (this = this * secondMatrix) +// Perform a concatenation of the matrices (this * secondMatrix) PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix) const { if (!secondMatrix) return 0; - TransformationMatrix tmp(m_matrix); - tmp.multiply(secondMatrix->m_matrix); + TransformationMatrix tmp(secondMatrix->m_matrix); + tmp.multiply(m_matrix); return WebKitCSSMatrix::create(tmp); } diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 3f7818e..01103f4 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -362,12 +362,14 @@ input::-webkit-input-list-button { input::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; display: inline-block; + -webkit-user-select: none; } input::-webkit-outer-spin-button { -webkit-appearance: outer-spin-button; display: inline-block; margin-left: 2px; + -webkit-user-select: none; } textarea { diff --git a/WebCore/css/mathml.css b/WebCore/css/mathml.css index 8b4da3e..5c9038a 100644 --- a/WebCore/css/mathml.css +++ b/WebCore/css/mathml.css @@ -132,14 +132,23 @@ msqrt { mroot { display: inline-block; + position: relative; padding-top: 0.2em; padding-left: 0.2em; } mroot > * + * { font-size: 0.75em; - vertical-align: top; - padding-right: 0.3em; + vertical-align: bottom; + position: absolute; + left: 0px; + padding-right: 0.4em; + padding-left: 0.2em; + padding-bottom: 0.2em; +} + +mroot > * + mrow, mroot > * + mfenced { + padding-bottom: 0.4em; } mtable { diff --git a/WebCore/css/tokenizer.flex b/WebCore/css/tokenizer.flex index 3af725c..290c590 100644 --- a/WebCore/css/tokenizer.flex +++ b/WebCore/css/tokenizer.flex @@ -53,6 +53,22 @@ nth [\+-]?{intnum}*n([\+-]{intnum})? "@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;} "@page" {yyTok = PAGE_SYM; return yyTok;} +"@top-left-corner" {yyTok = TOPLEFTCORNER_SYM; return yyTok;} +"@top-left" {yyTok = TOPLEFT_SYM; return yyTok;} +"@top-center" {yyTok = TOPCENTER_SYM; return yyTok;} +"@top-right" {yyTok = TOPRIGHT_SYM; return yyTok;} +"@top-right-corner" {yyTok = TOPRIGHTCORNER_SYM; return yyTok;} +"@bottom-left-corner" {yyTok = BOTTOMLEFTCORNER_SYM; return yyTok;} +"@bottom-left" {yyTok = BOTTOMLEFT_SYM; return yyTok;} +"@bottom-center" {yyTok = BOTTOMCENTER_SYM; return yyTok;} +"@bottom-right" {yyTok = BOTTOMRIGHT_SYM; return yyTok;} +"@bottom-right-corner" {yyTok = BOTTOMRIGHTCORNER_SYM; return yyTok;} +"@left-top" {yyTok = LEFTTOP_SYM; return yyTok;} +"@left-middle" {yyTok = LEFTMIDDLE_SYM; return yyTok;} +"@left-bottom" {yyTok = LEFTBOTTOM_SYM; return yyTok;} +"@right-top" {yyTok = RIGHTTOP_SYM; return yyTok;} +"@right-middle" {yyTok = RIGHTMIDDLE_SYM; return yyTok;} +"@right-bottom" {yyTok = RIGHTBOTTOM_SYM; return yyTok;} "@media" {BEGIN(mediaquery); yyTok = MEDIA_SYM; return yyTok;} "@font-face" {yyTok = FONT_FACE_SYM; return yyTok;} "@charset" {yyTok = CHARSET_SYM; return yyTok;} |
