diff options
Diffstat (limited to 'WebCore/css')
47 files changed, 283 insertions, 170 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index 65a6ecf..ce43cd6 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -33,10 +33,8 @@ #include "CSSReflectValue.h" #include "CSSTimingFunctionValue.h" #include "CSSValueList.h" -#include "CachedImage.h" #include "Document.h" #include "ExceptionCode.h" -#include "Pair.h" #include "Rect.h" #include "RenderBox.h" #include "RenderLayer.h" @@ -177,6 +175,7 @@ static const int computedProperties[] = { CSSPropertyWebkitBoxReflect, CSSPropertyWebkitBoxShadow, CSSPropertyWebkitBoxSizing, + CSSPropertyWebkitColorCorrection, CSSPropertyWebkitColumnBreakAfter, CSSPropertyWebkitColumnBreakBefore, CSSPropertyWebkitColumnBreakInside, @@ -915,9 +914,9 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return CSSPrimitiveValue::createIdentifier(CSSValueNormal); return CSSPrimitiveValue::create(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); case CSSPropertyWebkitLineClamp: - if (style->lineClamp() == -1) + if (style->lineClamp().isNone()) return CSSPrimitiveValue::createIdentifier(CSSValueNone); - return CSSPrimitiveValue::create(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); + return CSSPrimitiveValue::create(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyLineHeight: { Length length = style->lineHeight(); if (length.isNegative()) @@ -1391,6 +1390,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return getTimingFunctionValue(style->transitions()); case CSSPropertyPointerEvents: return CSSPrimitiveValue::create(style->pointerEvents()); + case CSSPropertyWebkitColorCorrection: + return CSSPrimitiveValue::create(style->colorSpace()); /* Shorthand properties, currently not supported see bug 13658*/ case CSSPropertyBackground: @@ -1522,7 +1523,7 @@ unsigned CSSComputedStyleDeclaration::length() const String CSSComputedStyleDeclaration::item(unsigned i) const { if (i >= length()) - return String(); + return ""; return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i])); } diff --git a/WebCore/css/CSSCursorImageValue.cpp b/WebCore/css/CSSCursorImageValue.cpp index c1a517c..fe10cf3 100644 --- a/WebCore/css/CSSCursorImageValue.cpp +++ b/WebCore/css/CSSCursorImageValue.cpp @@ -25,7 +25,6 @@ #include "DocLoader.h" #include "Document.h" #include "PlatformString.h" -#include "RenderStyle.h" #include <wtf/MathExtras.h> #include <wtf/UnusedParam.h> diff --git a/WebCore/css/CSSFontSelector.cpp b/WebCore/css/CSSFontSelector.cpp index 35bc876..ce3253c 100644 --- a/WebCore/css/CSSFontSelector.cpp +++ b/WebCore/css/CSSFontSelector.cpp @@ -45,7 +45,6 @@ #include "FontCache.h" #include "FontFamilyValue.h" #include "Frame.h" -#include "NodeList.h" #include "RenderObject.h" #include "Settings.h" #include "SimpleFontData.h" diff --git a/WebCore/css/CSSGradientValue.cpp b/WebCore/css/CSSGradientValue.cpp index 3f45e47..5946d7a 100644 --- a/WebCore/css/CSSGradientValue.cpp +++ b/WebCore/css/CSSGradientValue.cpp @@ -29,9 +29,7 @@ #include "CSSStyleSelector.h" #include "GeneratedImage.h" #include "Gradient.h" -#include "GraphicsContext.h" #include "Image.h" -#include "ImageBuffer.h" #include "IntSize.h" #include "IntSizeHash.h" #include "PlatformString.h" diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y index 0530e91..22e3aaf 100644 --- a/WebCore/css/CSSGrammar.y +++ b/WebCore/css/CSSGrammar.y @@ -97,7 +97,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %} -%expect 51 +%expect 48 %nonassoc LOWEST_PREC @@ -184,18 +184,15 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <rule> charset %type <rule> ruleset -%type <rule> valid_rule_or_import %type <rule> media %type <rule> import +%type <rule> namespace %type <rule> page %type <rule> font_face %type <rule> keyframes %type <rule> invalid_rule %type <rule> save_block %type <rule> invalid_at -%type <rule> invalid_at_list -%type <rule> invalid_import -%type <rule> invalid_media %type <rule> rule %type <rule> valid_rule %type <ruleList> block_rule_list @@ -268,7 +265,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %% stylesheet: - maybe_space maybe_charset maybe_sgml import_list variables_list namespace_list rule_list + maybe_space maybe_charset maybe_sgml rule_list | webkit_rule maybe_space | webkit_decls maybe_space | webkit_value maybe_space @@ -278,13 +275,8 @@ stylesheet: | webkit_keyframe_rule maybe_space ; -valid_rule_or_import: - valid_rule - | import - ; - webkit_rule: - WEBKIT_RULE_SYM '{' maybe_space valid_rule_or_import maybe_space '}' { + WEBKIT_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { static_cast<CSSParser*>(parser)->m_rule = $4; } ; @@ -373,31 +365,6 @@ charset: } ; -import_list: - /* empty */ - | import_list import maybe_sgml { - CSSParser* p = static_cast<CSSParser*>(parser); - if ($2 && p->m_styleSheet) - p->m_styleSheet->append($2); - } - | invalid_at_list { - } - ; - -variables_list: -/* empty */ -| variables_list variables_rule maybe_sgml { - CSSParser* p = static_cast<CSSParser*>(parser); - if ($2 && p->m_styleSheet) - p->m_styleSheet->append($2); -} -; - -namespace_list: -/* empty */ -| namespace_list namespace maybe_sgml -; - rule_list: /* empty */ | rule_list rule maybe_sgml { @@ -413,13 +380,15 @@ valid_rule: | page | font_face | keyframes + | namespace + | import + | variables_rule ; rule: valid_rule | invalid_rule | invalid_at - | invalid_import ; block_rule_list: @@ -445,8 +414,10 @@ block_rule: block_valid_rule | invalid_rule | invalid_at - | invalid_import - | invalid_media + | namespace + | import + | variables_rule + | media ; @@ -570,17 +541,23 @@ variable_name: namespace: NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { - CSSParser* p = static_cast<CSSParser*>(parser); - if (p->m_styleSheet) - p->m_styleSheet->addNamespace(p, $3, $4); + static_cast<CSSParser*>(parser)->addNamespace($3, $4); + $$ = 0; +} +| NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_block { + $$ = 0; +} +| NAMESPACE_SYM error invalid_block { + $$ = 0; +} +| NAMESPACE_SYM error ';' { + $$ = 0; } -| NAMESPACE_SYM error invalid_block -| NAMESPACE_SYM error ';' ; maybe_ns_prefix: /* empty */ { $$.characters = 0; } -| IDENT WHITESPACE { $$ = $1; } +| IDENT maybe_space { $$ = $1; } ; string_or_uri: @@ -1481,23 +1458,6 @@ invalid_at: } ; -invalid_at_list: - invalid_at maybe_sgml - | invalid_at_list invalid_at maybe_sgml - ; - -invalid_import: - import { - $$ = 0; - } - ; - -invalid_media: - media { - $$ = 0; - } - ; - invalid_rule: error invalid_block { $$ = 0; diff --git a/WebCore/css/CSSImageValue.cpp b/WebCore/css/CSSImageValue.cpp index 3432a4e..96a8dec 100644 --- a/WebCore/css/CSSImageValue.cpp +++ b/WebCore/css/CSSImageValue.cpp @@ -25,7 +25,6 @@ #include "Cache.h" #include "CachedImage.h" #include "DocLoader.h" -#include "RenderStyle.h" #include "StyleCachedImage.h" namespace WebCore { diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp index 2fe7abf..8534adf 100644 --- a/WebCore/css/CSSImportRule.cpp +++ b/WebCore/css/CSSImportRule.cpp @@ -25,7 +25,6 @@ #include "CachedCSSStyleSheet.h" #include "DocLoader.h" #include "Document.h" -#include "MediaList.h" #include "Settings.h" #include <wtf/StdLibExtras.h> diff --git a/WebCore/css/CSSInheritedValue.cpp b/WebCore/css/CSSInheritedValue.cpp index 08d3db3..20b73e2 100644 --- a/WebCore/css/CSSInheritedValue.cpp +++ b/WebCore/css/CSSInheritedValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/CSSInitialValue.cpp b/WebCore/css/CSSInitialValue.cpp index 9c2bb23..cbe776b 100644 --- a/WebCore/css/CSSInitialValue.cpp +++ b/WebCore/css/CSSInitialValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/CSSMediaRule.cpp b/WebCore/css/CSSMediaRule.cpp index 610e988..d1c220b 100644 --- a/WebCore/css/CSSMediaRule.cpp +++ b/WebCore/css/CSSMediaRule.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 2dd2f5d..b86be05 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -23,7 +23,6 @@ #include "CSSImageValue.h" #include "CSSParser.h" -#include "CSSProperty.h" #include "CSSPropertyLonghand.h" #include "CSSPropertyNames.h" #include "CSSRule.h" @@ -259,20 +258,28 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const String CSSMutableStyleDeclaration::get4Values(const int* properties) const { - String res; - for (int i = 0; i < 4; ++i) { - if (!isPropertyImplicit(properties[i])) { - RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); + // Assume the properties are in the usual order top, right, bottom, left. + RefPtr<CSSValue> topValue = getPropertyCSSValue(properties[0]); + RefPtr<CSSValue> rightValue = getPropertyCSSValue(properties[1]); + RefPtr<CSSValue> bottomValue = getPropertyCSSValue(properties[2]); + RefPtr<CSSValue> leftValue = getPropertyCSSValue(properties[3]); - // apparently all 4 properties must be specified. - if (!value) - return String(); + // All 4 properties must be specified. + if (!topValue || !rightValue || !bottomValue || !leftValue) + return String(); + + bool showLeft = rightValue->cssText() != leftValue->cssText(); + bool showBottom = (topValue->cssText() != bottomValue->cssText()) || showLeft; + bool showRight = (topValue->cssText() != rightValue->cssText()) || showBottom; + + String res = topValue->cssText(); + if (showRight) + res += " " + rightValue->cssText(); + if (showBottom) + res += " " + bottomValue->cssText(); + if (showLeft) + res += " " + leftValue->cssText(); - if (!res.isNull()) - res += " "; - res += value->cssText(); - } - } return res; } @@ -628,7 +635,7 @@ unsigned CSSMutableStyleDeclaration::length() const String CSSMutableStyleDeclaration::item(unsigned i) const { if (i >= m_properties.size()) - return String(); + return ""; return getPropertyName(static_cast<CSSPropertyID>(m_properties[i].id())); } diff --git a/WebCore/css/CSSNamespace.h b/WebCore/css/CSSNamespace.h index 9194be8..0a1119d 100644 --- a/WebCore/css/CSSNamespace.h +++ b/WebCore/css/CSSNamespace.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) * 1999 Waldo Bastian (bastian@kde.org) * Copyright (C) 2004, 2006 Apple Computer, Inc. @@ -28,7 +26,7 @@ namespace WebCore { - struct CSSNamespace { + struct CSSNamespace : Noncopyable { AtomicString m_prefix; AtomicString m_uri; CSSNamespace* m_parent; diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 0da1b85..19d82ee 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -146,6 +146,9 @@ CSSParser::CSSParser(bool strictParsing) , m_defaultNamespace(starAtom) , m_data(0) , yy_start(1) + , m_allowImportRules(true) + , m_allowVariablesRules(true) + , m_allowNamespaceDeclarations(true) , m_floatingMediaQuery(0) , m_floatingMediaQueryExp(0) , m_floatingMediaQueryExpList(0) @@ -242,6 +245,7 @@ PassRefPtr<CSSRule> CSSParser::parseRule(CSSStyleSheet* sheet, const String& str android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); #endif m_styleSheet = sheet; + m_allowNamespaceDeclarations = false; setupParser("@-webkit-rule{", string, "} "); cssyyparse(this); #ifdef ANDROID_INSTRUMENT @@ -1297,6 +1301,9 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitBoxSizing: valid_primitive = id == CSSValueBorderBox || id == CSSValueContentBox; break; + case CSSPropertyWebkitColorCorrection: + valid_primitive = id == CSSValueSrgb || id == CSSValueDefault; + break; case CSSPropertyWebkitMarquee: { const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement, CSSPropertyWebkitMarqueeRepetition, @@ -1541,7 +1548,9 @@ bool CSSParser::parseValue(int propId, bool important) // Apple specific properties. These will never be standardized and are purely to // support custom WebKit-based Apple applications. case CSSPropertyWebkitLineClamp: - valid_primitive = (!id && validUnit(value, FPercent, false)); + // When specifying number of lines, don't allow 0 as a valid value + // When specifying either type of unit, require non-negative integers + valid_primitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTAGE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, false)); break; case CSSPropertyWebkitTextSizeAdjust: if (id == CSSValueAuto || id == CSSValueNone) @@ -3388,6 +3397,12 @@ bool CSSParser::parseFontWeight(bool important) return false; } +static bool isValidFormatFunction(CSSParserValue* val) +{ + CSSParserValueList* args = val->function->args; + return equalIgnoringCase(val->function->name, "format(") && (args->current()->unit == CSSPrimitiveValue::CSS_STRING || args->current()->unit == CSSPrimitiveValue::CSS_IDENT); +} + bool CSSParser::parseFontFaceSrc() { RefPtr<CSSValueList> values(CSSValueList::createCommaSeparated()); @@ -3415,7 +3430,7 @@ bool CSSParser::parseFontFaceSrc() CSSParserValue* a = args->current(); uriValue.clear(); parsedValue = CSSFontFaceSrcValue::createLocal(a->string); - } else if (equalIgnoringCase(val->function->name, "format(") && allowFormat && uriValue) { + } else if (allowFormat && uriValue && isValidFormatFunction(val)) { expectComma = true; allowFormat = false; uriValue->setFormat(args->current()->string); @@ -4673,11 +4688,13 @@ static inline int yyerror(const char*) { return 1; } int CSSParser::lex(void* yylvalWithoutType) { YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); - int token = lex(); int length; + + lex(); + UChar* t = text(&length); - switch (token) { + switch (token()) { case WHITESPACE: case SGML_CD: case INCLUDES: @@ -4743,7 +4760,7 @@ int CSSParser::lex(void* yylvalWithoutType) break; } - return token; + return token(); } static inline bool isCSSWhitespace(UChar c) @@ -4751,6 +4768,28 @@ static inline bool isCSSWhitespace(UChar c) return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'; } +void CSSParser::recheckAtKeyword(const UChar* str, int len) +{ + String ruleName(str, len); + if (equalIgnoringCase(ruleName, "@import")) + yyTok = IMPORT_SYM; + else if (equalIgnoringCase(ruleName, "@page")) + yyTok = PAGE_SYM; + else if (equalIgnoringCase(ruleName, "@media")) + yyTok = MEDIA_SYM; + else if (equalIgnoringCase(ruleName, "@font-face")) + yyTok = FONT_FACE_SYM; + else if (equalIgnoringCase(ruleName, "@charset")) + yyTok = CHARSET_SYM; + else if (equalIgnoringCase(ruleName, "@namespace")) + yyTok = NAMESPACE_SYM; + else if (equalIgnoringCase(ruleName, "@-webkit-keyframes")) + 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) { UChar* start = yytext; @@ -4804,6 +4843,8 @@ UChar* CSSParser::text(int *length) UChar* out = start; UChar* escape = 0; + bool sawEscape = false; + for (int i = 0; i < l; i++) { UChar* current = start + i; if (escape == current - 1) { @@ -4848,6 +4889,7 @@ UChar* CSSParser::text(int *length) } if (!escape && *current == '\\') { escape = current; + sawEscape = true; continue; } *out++ = *current; @@ -4868,6 +4910,12 @@ UChar* CSSParser::text(int *length) } *length = out - start; + + // If we have an unrecognized @-keyword, and if we handled any escapes at all, then + // we should attempt to adjust yyTok to the correct type. + if (yyTok == ATKEYWORD && sawEscape) + recheckAtKeyword(start, *length); + return start; } @@ -4998,7 +5046,7 @@ CSSRule* CSSParser::createCharsetRule(const CSSParserString& charset) CSSRule* CSSParser::createImportRule(const CSSParserString& url, MediaList* media) { - if (!media || !m_styleSheet) + if (!media || !m_styleSheet || !m_allowImportRules) return 0; RefPtr<CSSImportRule> rule = CSSImportRule::create(m_styleSheet, url, media); CSSImportRule* result = rule.get(); @@ -5010,6 +5058,7 @@ CSSRule* CSSParser::createMediaRule(MediaList* media, CSSRuleList* rules) { if (!media || !rules || !m_styleSheet) return 0; + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr<CSSMediaRule> rule = CSSMediaRule::create(m_styleSheet, media, rules); CSSMediaRule* result = rule.get(); m_parsedStyleObjects.append(rule.release()); @@ -5027,6 +5076,7 @@ CSSRuleList* CSSParser::createRuleList() WebKitCSSKeyframesRule* CSSParser::createKeyframesRule() { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr<WebKitCSSKeyframesRule> rule = WebKitCSSKeyframesRule::create(m_styleSheet); WebKitCSSKeyframesRule* rulePtr = rule.get(); m_parsedStyleObjects.append(rule.release()); @@ -5035,6 +5085,7 @@ WebKitCSSKeyframesRule* CSSParser::createKeyframesRule() CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors) { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; CSSStyleRule* result = 0; if (selectors) { RefPtr<CSSStyleRule> rule = CSSStyleRule::create(m_styleSheet); @@ -5051,6 +5102,7 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors) CSSRule* CSSParser::createFontFaceRule() { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet); for (unsigned i = 0; i < m_numParsedProperties; ++i) { CSSProperty* property = m_parsedProperties[i]; @@ -5068,6 +5120,15 @@ CSSRule* CSSParser::createFontFaceRule() return result; } +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) @@ -5089,6 +5150,9 @@ bool CSSParser::addVariableDeclarationBlock(const CSSParserString&) 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(); diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index 6d1bb32..d032886 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -187,13 +187,15 @@ namespace WebCore { MediaQuery* createFloatingMediaQuery(Vector<MediaQueryExp*>*); MediaQuery* sinkFloatingMediaQuery(MediaQuery*); + 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); Vector<CSSSelector*>* reusableSelectorVector() { return &m_reusableSelectorVector; } - + bool m_strict; bool m_important; int m_id; @@ -225,6 +227,8 @@ namespace WebCore { int lex(); private: + void recheckAtKeyword(const UChar* str, int len); + void clearProperties(); void setupParser(const char* prefix, const String&, const char* suffix); @@ -247,6 +251,10 @@ namespace WebCore { int yyTok; int yy_start; + bool m_allowImportRules; + bool m_allowVariablesRules; + bool m_allowNamespaceDeclarations; + Vector<RefPtr<StyleBase> > m_parsedStyleObjects; Vector<RefPtr<CSSRuleList> > m_parsedRuleLists; HashSet<CSSSelector*> m_floatingSelectors; @@ -287,7 +295,7 @@ namespace WebCore { int cssPropertyID(const String&); int cssValueKeywordID(const CSSParserString&); - class ShorthandScope { + class ShorthandScope : public FastAllocBase { public: ShorthandScope(CSSParser* parser, int propId) : m_parser(parser) { diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 6f89df9..3c6097b 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Redistribution and use in source and binary forms, with or without @@ -28,6 +28,7 @@ #ifndef CSSPrimitiveValueMappings_h #define CSSPrimitiveValueMappings_h +#include "ColorSpace.h" #include "CSSPrimitiveValue.h" #include "CSSValueKeywords.h" #include "FontSmoothingMode.h" @@ -229,6 +230,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MediaReturnToRealtimeButtonPart: m_value.ident = CSSValueMediaReturnToRealtimeButton; break; + case MediaToggleClosedCaptionsButtonPart: + m_value.ident = CSSValueMediaToggleClosedCaptionsButton; + break; case MediaSliderPart: m_value.ident = CSSValueMediaSlider; break; @@ -1881,6 +1885,32 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space) + : m_type(CSS_IDENT) +{ + switch (space) { + case DeviceColorSpace: + m_value.ident = CSSValueDefault; + break; + case sRGBColorSpace: + m_value.ident = CSSValueSrgb; + break; + } +} + +template<> inline CSSPrimitiveValue::operator ColorSpace() const +{ + switch (m_value.ident) { + case CSSValueDefault: + return DeviceColorSpace; + case CSSValueSrgb: + return sRGBColorSpace; + default: + ASSERT_NOT_REACHED(); + return DeviceColorSpace; + } +} + #if ENABLE(SVG) template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e) diff --git a/WebCore/css/CSSProperty.cpp b/WebCore/css/CSSProperty.cpp index 9b21a3f..d7f2175 100644 --- a/WebCore/css/CSSProperty.cpp +++ b/WebCore/css/CSSProperty.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/CSSProperty.h b/WebCore/css/CSSProperty.h index b5635d0..4505f33 100644 --- a/WebCore/css/CSSProperty.h +++ b/WebCore/css/CSSProperty.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index dff3a2b..fe610de 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -185,6 +185,7 @@ zoom -webkit-box-reflect -webkit-box-shadow -webkit-box-sizing +-webkit-color-correction -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside diff --git a/WebCore/css/CSSRule.cpp b/WebCore/css/CSSRule.cpp index 8fe4caf..43d8eac 100644 --- a/WebCore/css/CSSRule.cpp +++ b/WebCore/css/CSSRule.cpp @@ -22,7 +22,6 @@ #include "config.h" #include "CSSRule.h" -#include "CSSStyleSheet.h" #include "NotImplemented.h" namespace WebCore { diff --git a/WebCore/css/CSSRuleList.cpp b/WebCore/css/CSSRuleList.cpp index 4528d40..7367ab2 100644 --- a/WebCore/css/CSSRuleList.cpp +++ b/WebCore/css/CSSRuleList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. diff --git a/WebCore/css/CSSRuleList.h b/WebCore/css/CSSRuleList.h index 26186b3..a355c4a 100644 --- a/WebCore/css/CSSRuleList.h +++ b/WebCore/css/CSSRuleList.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2006 Apple Computer, Inc. diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 313528f..ab2d22b 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -116,6 +116,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsReturnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button")); + DEFINE_STATIC_LOCAL(AtomicString, mediaControlsToggleClosedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container")); @@ -271,6 +272,9 @@ void CSSSelector::extractPseudoType() const } else if (m_value == mediaControlsReturnToRealtimeButton) { m_pseudoType = PseudoMediaControlsReturnToRealtimeButton; element = true; + } else if (m_value == mediaControlsToggleClosedCaptionsButton) { + m_pseudoType = PseudoMediaControlsToggleClosedCaptions; + element = true; } else if (m_value == mediaControlsStatusDisplay) { m_pseudoType = PseudoMediaControlsStatusDisplay; element = true; diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 0c3b677..95a72e4 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) * 1999 Waldo Bastian (bastian@kde.org) * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. @@ -176,6 +174,7 @@ namespace WebCore { PseudoMediaControlsVolumeSliderContainer, PseudoMediaControlsCurrentTimeDisplay, PseudoMediaControlsTimeRemainingDisplay, + PseudoMediaControlsToggleClosedCaptions, PseudoMediaControlsTimeline, PseudoMediaControlsVolumeSlider, PseudoMediaControlsSeekBackButton, @@ -230,7 +229,7 @@ namespace WebCore { void extractPseudoType() const; - struct RareData { + struct RareData : Noncopyable { RareData(CSSSelector* tagHistory) : m_tagHistory(tagHistory) , m_simpleSelector(0) diff --git a/WebCore/css/CSSStyleDeclaration.idl b/WebCore/css/CSSStyleDeclaration.idl index 3e37418..42682ef 100644 --- a/WebCore/css/CSSStyleDeclaration.idl +++ b/WebCore/css/CSSStyleDeclaration.idl @@ -44,7 +44,7 @@ module css { raises(DOMException); readonly attribute unsigned long length; - [ConvertNullStringTo=Null] DOMString item(in unsigned long index); + DOMString item(in unsigned long index); readonly attribute CSSRule parentRule; // Extensions diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 3276964..b3f5d72 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -28,14 +28,11 @@ #include "CSSBorderImageValue.h" #include "CSSCursorImageValue.h" -#include "CSSFontFace.h" #include "CSSFontFaceRule.h" -#include "CSSFontFaceSource.h" #include "CSSImportRule.h" #include "CSSMediaRule.h" #include "CSSParser.h" #include "CSSPrimitiveValueMappings.h" -#include "CSSProperty.h" #include "CSSPropertyNames.h" #include "CSSReflectValue.h" #include "CSSRuleList.h" @@ -61,6 +58,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLTextAreaElement.h" +#include "KeyframeList.h" #include "LinkHash.h" #include "MappedAttribute.h" #include "MatrixTransformOperation.h" @@ -350,7 +348,7 @@ if (id == propID) { \ return; \ } -class CSSRuleSet { +class CSSRuleSet : public Noncopyable { public: CSSRuleSet(); ~CSSRuleSet(); @@ -662,7 +660,7 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l matchRulesForList(rules->getIDRules(m_element->getIDAttribute().impl()), firstRuleIndex, lastRuleIndex); if (m_element->hasClass()) { ASSERT(m_styledElement); - const ClassNames& classNames = m_styledElement->classNames(); + const SpaceSplitString& classNames = m_styledElement->classNames(); size_t size = classNames.size(); for (size_t i = 0; i < size; ++i) matchRulesForList(rules->getClassRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex); @@ -2556,6 +2554,9 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoMediaControlsReturnToRealtimeButton: dynamicPseudo = MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON; return true; + case CSSSelector::PseudoMediaControlsToggleClosedCaptions: + dynamicPseudo = MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON; + return true; case CSSSelector::PseudoMediaControlsStatusDisplay: dynamicPseudo = MEDIA_CONTROLS_STATUS_DISPLAY; return true; @@ -5000,13 +5001,15 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitMarginBottomCollapse: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginBottomCollapse, MarginBottomCollapse) return; - - // Apple-specific changes. Do not merge these properties into KHTML. case CSSPropertyWebkitLineClamp: { HANDLE_INHERIT_AND_INITIAL(lineClamp, LineClamp) if (!primitiveValue) return; - m_style->setLineClamp(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE)); + int type = primitiveValue->primitiveType(); + if (type == CSSPrimitiveValue::CSS_NUMBER) + m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_NUMBER), LineClampLineCount)); + else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) + m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE), LineClampPercentage)); return; } case CSSPropertyWebkitHighlight: { @@ -5267,6 +5270,17 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setPointerEvents(*primitiveValue); return; } + case CSSPropertyWebkitColorCorrection: + if (isInherit) + m_style->setColorSpace(m_parentStyle->colorSpace()); + else if (isInitial) + m_style->setColorSpace(DeviceColorSpace); + else { + if (!primitiveValue) + return; + m_style->setColorSpace(*primitiveValue); + } + return; case CSSPropertyInvalid: return; case CSSPropertyFontStretch: diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index 6e0663f..fab5006 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -23,7 +23,6 @@ #define CSSStyleSelector_h #include "CSSFontSelector.h" -#include "KeyframeList.h" #include "LinkHash.h" #include "MediaQueryExp.h" #include "RenderStyle.h" @@ -56,6 +55,7 @@ class Element; class Frame; class FrameView; class KURL; +class KeyframeList; class MediaQueryEvaluator; class Node; class Settings; @@ -65,7 +65,7 @@ class StyleSheetList; class StyledElement; class WebKitCSSKeyframesRule; -class MediaQueryResult { +class MediaQueryResult : public Noncopyable { public: MediaQueryResult(const MediaQueryExp& expr, bool result) : m_expression(expr) @@ -286,7 +286,7 @@ public: HashMap<CSSMutableStyleDeclaration*, RefPtr<CSSMutableStyleDeclaration> > m_resolvedVariablesDeclarations; }; - class CSSRuleData { + class CSSRuleData : public Noncopyable { public: CSSRuleData(unsigned pos, CSSStyleRule* r, CSSSelector* sel, CSSRuleData* prev = 0) : m_position(pos) @@ -314,7 +314,7 @@ public: CSSRuleData* m_next; }; - class CSSRuleDataList { + class CSSRuleDataList : public Noncopyable { public: CSSRuleDataList(unsigned pos, CSSStyleRule* rule, CSSSelector* sel) : m_first(new CSSRuleData(pos, rule, sel)) diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index 1579999..f6cd6f2 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -28,6 +28,7 @@ #include "Document.h" #include "ExceptionCode.h" #include "Node.h" +#include "SecurityOrigin.h" #include "TextEncoding.h" #include <wtf/Deque.h> @@ -118,6 +119,8 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules) { + if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) + return 0; return CSSRuleList::create(this, omitCharsetRules); } @@ -135,7 +138,7 @@ void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) void CSSStyleSheet::addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri) { - if (uri.isEmpty()) + if (uri.isNull()) return; m_namespaces = new CSSNamespace(prefix, uri, m_namespaces); @@ -148,11 +151,11 @@ void CSSStyleSheet::addNamespace(CSSParser* p, const AtomicString& prefix, const const AtomicString& CSSStyleSheet::determineNamespace(const AtomicString& prefix) { - if (prefix.isEmpty()) + if (prefix.isNull()) return nullAtom; // No namespace. If an element/attribute has a namespace, we won't match it. - else if (prefix == starAtom) + if (prefix == starAtom) return starAtom; // We'll match any namespace. - else if (m_namespaces) { + if (m_namespaces) { CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix); if (ns) return ns->uri(); @@ -227,10 +230,12 @@ void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet<KURL>& urls) CSSStyleSheet* styleSheet = styleSheetQueue.first(); styleSheetQueue.removeFirst(); - RefPtr<CSSRuleList> ruleList = styleSheet->cssRules(); - - for (unsigned i = 0; i < ruleList->length(); ++i) { - CSSRule* rule = ruleList->item(i); + for (unsigned i = 0; i < styleSheet->length(); ++i) { + StyleBase* styleBase = styleSheet->item(i); + if (!styleBase->isRule()) + continue; + + CSSRule* rule = static_cast<CSSRule*>(styleBase); if (rule->isImportRule()) { if (CSSStyleSheet* ruleStyleSheet = static_cast<CSSImportRule*>(rule)->styleSheet()) styleSheetQueue.append(ruleStyleSheet); diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index 1b7b1d8..1c35b23 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -511,6 +511,7 @@ media-seek-back-button media-seek-forward-button media-rewind-button media-return-to-realtime-button +media-toggle-closed-captions-button media-slider media-sliderthumb media-volume-slider-container @@ -638,3 +639,7 @@ subpixel-antialiased optimizeSpeed optimizeLegibility geometricPrecision + +# -webkit-color-correction +#default +sRGB diff --git a/WebCore/css/CSSValueList.cpp b/WebCore/css/CSSValueList.cpp index 9633f7c..8f1f88d 100644 --- a/WebCore/css/CSSValueList.cpp +++ b/WebCore/css/CSSValueList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. * diff --git a/WebCore/css/FontValue.cpp b/WebCore/css/FontValue.cpp index 231ac64..991fc6e 100644 --- a/WebCore/css/FontValue.cpp +++ b/WebCore/css/FontValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/MediaFeatureNames.cpp b/WebCore/css/MediaFeatureNames.cpp index fcee5de..a7799c1 100644 --- a/WebCore/css/MediaFeatureNames.cpp +++ b/WebCore/css/MediaFeatureNames.cpp @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2005 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or diff --git a/WebCore/css/MediaFeatureNames.h b/WebCore/css/MediaFeatureNames.h index 5196586..2799004 100644 --- a/WebCore/css/MediaFeatureNames.h +++ b/WebCore/css/MediaFeatureNames.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 2005 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or diff --git a/WebCore/css/MediaQuery.h b/WebCore/css/MediaQuery.h index ff22d9a..7cbd3bf 100644 --- a/WebCore/css/MediaQuery.h +++ b/WebCore/css/MediaQuery.h @@ -34,7 +34,7 @@ namespace WebCore { class MediaQueryExp; -class MediaQuery { +class MediaQuery : public Noncopyable { public: enum Restrictor { Only, Not, None diff --git a/WebCore/css/MediaQueryEvaluator.h b/WebCore/css/MediaQueryEvaluator.h index 404504b..00ac394 100644 --- a/WebCore/css/MediaQueryEvaluator.h +++ b/WebCore/css/MediaQueryEvaluator.h @@ -49,7 +49,7 @@ class MediaQueryExp; * the device characteristics are not known. This can be used to prune the loading * of stylesheets to only those which are probable to match. */ -class MediaQueryEvaluator { +class MediaQueryEvaluator : public Noncopyable { public: /** Creates evaluator which evaluates only simple media queries * Evaluator returns true for "all", and returns value of \mediaFeatureResult diff --git a/WebCore/css/MediaQueryExp.h b/WebCore/css/MediaQueryExp.h index 5ff4af3..fd55cf6 100644 --- a/WebCore/css/MediaQueryExp.h +++ b/WebCore/css/MediaQueryExp.h @@ -36,7 +36,7 @@ namespace WebCore { class CSSParserValueList; -class MediaQueryExp { +class MediaQueryExp : public FastAllocBase { public: MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* values); ~MediaQueryExp(); diff --git a/WebCore/css/Pair.h b/WebCore/css/Pair.h index a2b127e..c76bd82 100644 --- a/WebCore/css/Pair.h +++ b/WebCore/css/Pair.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp index 7e4483f..6d131df 100644 --- a/WebCore/css/SVGCSSStyleSelector.cpp +++ b/WebCore/css/SVGCSSStyleSelector.cpp @@ -10,8 +10,6 @@ (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com) (C) 2004 Germain Garand(germain@ebooksfrance.org) - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either diff --git a/WebCore/css/SVGCSSValueKeywords.in b/WebCore/css/SVGCSSValueKeywords.in index 152a68f..91fb57e 100644 --- a/WebCore/css/SVGCSSValueKeywords.in +++ b/WebCore/css/SVGCSSValueKeywords.in @@ -183,7 +183,7 @@ new # CSS_PROP_STOP_OPACITY # CSS_PROP_COLOR_INTERPOLATION #auto -sRGB +#sRGB linearRGB # CSS_PROP_COLOR_INTERPOLATION_FILTERS diff --git a/WebCore/css/ShadowValue.cpp b/WebCore/css/ShadowValue.cpp index 27be86c..060a322 100644 --- a/WebCore/css/ShadowValue.cpp +++ b/WebCore/css/ShadowValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc. * diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp index 16e6278..b4fb3b2 100644 --- a/WebCore/css/StyleSheet.cpp +++ b/WebCore/css/StyleSheet.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2006 Apple Computer, Inc. * diff --git a/WebCore/css/StyleSheetList.cpp b/WebCore/css/StyleSheetList.cpp index b9df810..2c90258 100644 --- a/WebCore/css/StyleSheetList.cpp +++ b/WebCore/css/StyleSheetList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. * diff --git a/WebCore/css/WebKitCSSKeyframesRule.cpp b/WebCore/css/WebKitCSSKeyframesRule.cpp index 440d7a2..23f9f34 100644 --- a/WebCore/css/WebKitCSSKeyframesRule.cpp +++ b/WebCore/css/WebKitCSSKeyframesRule.cpp @@ -108,8 +108,16 @@ WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::findRule(const String& s) int WebKitCSSKeyframesRule::findRuleIndex(const String& key) const { + String percentageString; + if (equalIgnoringCase(key, "from")) + percentageString = "0%"; + else if (equalIgnoringCase(key, "to")) + percentageString = "100%"; + else + percentageString = key; + for (unsigned i = 0; i < length(); ++i) { - if (item(i)->keyText() == key) + if (item(i)->keyText() == percentageString) return i; } diff --git a/WebCore/css/WebKitCSSKeyframesRule.h b/WebCore/css/WebKitCSSKeyframesRule.h index 8c76b61..f58406f 100644 --- a/WebCore/css/WebKitCSSKeyframesRule.h +++ b/WebCore/css/WebKitCSSKeyframesRule.h @@ -64,7 +64,7 @@ public: // themselves, or know that it will get called later. void setNameInternal(const String& name) { - m_name = name; + m_name = AtomicString(name); } CSSRuleList* cssRules() { return m_lstCSSRules.get(); } diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 095fab3..1132d24 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -607,6 +607,22 @@ a:-webkit-any-link:active { color: -webkit-activelink } +/* HTML5 ruby elements */ + +ruby, rt { + text-indent: 0; /* blocks used for ruby rendering should not trigger this */ +} + +ruby > rt { + display: block; + font-size: 60%; /* make slightly larger than 50% for better readability */ + text-align: center; +} + +ruby > rp { + display: none; +} + /* other elements */ noframes { diff --git a/WebCore/css/maketokenizer b/WebCore/css/maketokenizer index d14b37a..90d5fcb 100644 --- a/WebCore/css/maketokenizer +++ b/WebCore/css/maketokenizer @@ -1,7 +1,5 @@ print <<END; /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2003 Lars Knoll (knoll\@kde.org) * * @@ -73,30 +71,36 @@ typedef unsigned int flex_uint32_t; END } - +# Skip over the flex output prologue: the above typedefs, forward declarations, etc. +# Stop when we get to the declarations of tables. while (<>) { last if /YY_NUM_RULES/; } +# Dump the generated tables. /yy_last_accepting/ matches the first declaration after the tables. print; while (<>) { last if /yy_last_accepting/; print; } -# media query, tokenizer state support +# Skip down the the declaration of yytext; the body of the flex output begins after it. while (<>) { last if /yytext/; } +# Dump the definitions of states (INITIAL, media query, tokenizer state support). while (<>) { last if not (/define/ || /line/) ; print; } +# Skip to main scanner function. while (<>) { last if /^YY_DECL/; } +# Dump main scanner declarations, substituting in our 16-bit character type. +# Declarations end with the declaration matching /yy_act/. print; while (<>) { s/char/UChar/; @@ -104,23 +108,34 @@ while (<>) { last if /yy_act/; } +# Skip past initialization code, down to main loop. while (<>) { last if /while \( 1 \)/; } +# Dump the main loop, skipping over labels we don't use. +# Stop before dumping the end-of-buffer handling, because we output our own custom end-of-buffer handling. print; while (<>) { next if /^yy_match:/; next if /^do_action:/; last if /YY_END_OF_BUFFER/; + if (/^case YY_STATE_EOF\(INITIAL\):/) { + print "case YY_END_OF_BUFFER:\n"; + # flex outputs a ton of logic related to end-of-buffer handling; we just want to fall through to + # the yyterminate() found in other EOF states. But we need to be careful to back up to behind + # the terminating double-NUL so that subsequent calls to flex will have the pointers in order, + # so this logic is a reduction of the normal flex-generated YY_END_OF_BUFFER code. + print "\tyy_c_buf_p = yy_cp - 1;\n"; + print "\tyy_cp = yy_c_buf_p;\n"; + } print; - print "case YY_END_OF_BUFFER:\n" if /^case YY_STATE_EOF\(INITIAL\):/; } +# Skip over the end-of-buffer handling; dump the rest of the function. while (<>) { last if /default:/; } - print; while (<>) { print; diff --git a/WebCore/css/mediaControls.css b/WebCore/css/mediaControls.css index d0ec90d..de2c2fe 100644 --- a/WebCore/css/mediaControls.css +++ b/WebCore/css/mediaControls.css @@ -124,3 +124,10 @@ audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewin audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { display: none; } + +audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { + -webkit-appearance: media-toggle-closed-captions-button; + display: -webkit-box; + width: 16px; + height: 16px; +} diff --git a/WebCore/css/mediaControlsQuickTime.css b/WebCore/css/mediaControlsQuickTime.css index 5cf48ae..965685d 100644 --- a/WebCore/css/mediaControlsQuickTime.css +++ b/WebCore/css/mediaControlsQuickTime.css @@ -132,7 +132,7 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f height: 16px; margin-left: 7px; margin-right: 7px; - -webkit-box-ordinal-group: 3; /* At the very end */ + -webkit-box-ordinal-group: 4; /* At the very end */ } audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { @@ -175,3 +175,13 @@ audio::-webkit-media-controls-status-display, video::-webkit-media-controls-stat text-indent: 0; text-decoration: none; } + +audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { + -webkit-appearance: media-toggle-closed-captions-button; + display: -webkit-box; + width: 16px; + height: 16px; + margin-left: 7px; + margin-right: 7px; + -webkit-box-ordinal-group: 3; /* between mute and fullscreen */ +} |