diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/css | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/css')
33 files changed, 763 insertions, 159 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index cb5d5c2..43edc2d 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -292,7 +292,7 @@ static const int computedProperties[] = { #endif }; -const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]); +const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties); static int valueForRepeatRule(int rule) { diff --git a/WebCore/css/CSSFontFaceRule.idl b/WebCore/css/CSSFontFaceRule.idl index bd38a61..b9355a1 100644 --- a/WebCore/css/CSSFontFaceRule.idl +++ b/WebCore/css/CSSFontFaceRule.idl @@ -21,7 +21,7 @@ module css { // Introduced in DOM Level 2: - interface CSSFontFaceRule : CSSRule { + interface [CustomMarkFunction] CSSFontFaceRule : CSSRule { readonly attribute CSSStyleDeclaration style; }; diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp index d951e5d..03edbcb 100644 --- a/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/WebCore/css/CSSFontFaceSrcValue.cpp @@ -48,7 +48,7 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const // we will also check to see if the URL ends with .eot. If so, we'll go ahead and assume that we shouldn't load it. if (m_format.isEmpty()) { // Check for .eot. - if (m_resource.endsWith("eot", false)) + if (!m_resource.startsWith("data:", false) && m_resource.endsWith(".eot", false)) return false; return true; } diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y index 5c77340..db79b68 100644 --- a/WebCore/css/CSSGrammar.y +++ b/WebCore/css/CSSGrammar.y @@ -180,8 +180,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %token <number> TURNS %token <number> MSECS %token <number> SECS -%token <number> HERZ -%token <number> KHERZ +%token <number> HERTZ +%token <number> KHERTZ %token <string> DIMEN %token <number> PERCENTAGE %token <number> FLOATTOKEN @@ -1294,11 +1294,9 @@ declaration: p->m_valueList = p->sinkFloatingValueList($4); int oldParsedProperties = p->m_numParsedProperties; $$ = p->parseValue($1, $5); - if (!$$) { - if (static_cast<int>(p->m_numParsedProperties) == oldParsedProperties) - isPropertyParsed = true; + if (!$$) p->rollbackLastProperties(p->m_numParsedProperties - oldParsedProperties); - } else + else isPropertyParsed = true; delete p->m_valueList; p->m_valueList = 0; @@ -1446,8 +1444,8 @@ unary_term: | TURNS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_TURN; } | MSECS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_MS; } | SECS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_S; } - | HERZ maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_HZ; } - | KHERZ maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_KHZ; } + | HERTZ maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_HZ; } + | KHERTZ maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_KHZ; } | EMS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_EMS; } | QEMS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSParserValue::Q_EMS; } | EXS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_EXS; } diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp index 192f44e..3065478 100644 --- a/WebCore/css/CSSImportRule.cpp +++ b/WebCore/css/CSSImportRule.cpp @@ -112,7 +112,7 @@ bool CSSImportRule::isLoading() const void CSSImportRule::insertedIntoParent() { CSSStyleSheet* parentSheet = parentStyleSheet(); - if (!parentSheet) + if (!parentSheet || !parentSheet->document()) return; CachedResourceLoader* cachedResourceLoader = parentSheet->document()->cachedResourceLoader(); @@ -142,7 +142,7 @@ void CSSImportRule::insertedIntoParent() // if the import rule is issued dynamically, the sheet may be // removed from the pending sheet count, so let the doc know // the sheet being imported is pending. - if (parentSheet && parentSheet->loadCompleted() && root == parentSheet) + if (parentSheet && parentSheet->loadCompleted() && parentSheet->document()) parentSheet->document()->addPendingSheet(); m_loading = true; m_cachedSheet->addClient(this); diff --git a/WebCore/css/CSSImportRule.idl b/WebCore/css/CSSImportRule.idl index 05654fe..5ffdee0 100644 --- a/WebCore/css/CSSImportRule.idl +++ b/WebCore/css/CSSImportRule.idl @@ -21,7 +21,7 @@ module css { // Introduced in DOM Level 2: - interface CSSImportRule : CSSRule { + interface [CustomMarkFunction] CSSImportRule : CSSRule { readonly attribute [ConvertNullStringTo=Null] DOMString href; readonly attribute MediaList media; readonly attribute CSSStyleSheet styleSheet; diff --git a/WebCore/css/CSSMediaRule.idl b/WebCore/css/CSSMediaRule.idl index 4b75f49..a58020a 100644 --- a/WebCore/css/CSSMediaRule.idl +++ b/WebCore/css/CSSMediaRule.idl @@ -21,7 +21,7 @@ module css { // Introduced in DOM Level 2: - interface CSSMediaRule : CSSRule { + interface [CustomMarkFunction] CSSMediaRule : CSSRule { readonly attribute MediaList media; readonly attribute CSSRuleList cssRules; diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 774a8eb..14fb271 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -142,8 +142,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor }}; String res; - const int nrprops = sizeof(properties) / sizeof(properties[0]); - for (int i = 0; i < nrprops; ++i) { + for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { String value = getCommonValue(properties[i], 4); if (!value.isNull()) { if (!res.isNull()) @@ -772,7 +771,7 @@ static const int blockProperties[] = { CSSPropertyWidows }; -const unsigned numBlockProperties = sizeof(blockProperties) / sizeof(blockProperties[0]); +const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties); PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyBlockProperties() const { diff --git a/WebCore/css/CSSPageRule.idl b/WebCore/css/CSSPageRule.idl index 989fd8d..709222b 100644 --- a/WebCore/css/CSSPageRule.idl +++ b/WebCore/css/CSSPageRule.idl @@ -21,7 +21,7 @@ module css { // Introduced in DOM Level 2: - interface CSSPageRule : CSSRule { + interface [CustomMarkFunction] CSSPageRule : CSSRule { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 1e30272..9726e18 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -145,6 +145,7 @@ CSSParser::CSSParser(bool strictParsing) , m_hasFontFaceOnlyValues(false) , m_hadSyntacticallyValidCSSRule(false) , m_defaultNamespace(starAtom) + , m_inStyleRuleOrDeclaration(false) , m_selectorListRange(0, 0) , m_ruleBodyRange(0, 0) , m_propertyRange(UINT_MAX, UINT_MAX) @@ -386,6 +387,7 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const if (styleSourceData) { m_currentRuleData = CSSRuleSourceData::create(); m_currentRuleData->styleSourceData = CSSStyleSourceData::create(); + m_inStyleRuleOrDeclaration = true; } setupParser("@-webkit-decls{", string, "} "); @@ -413,6 +415,7 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const if (styleSourceData) { *styleSourceData = m_currentRuleData->styleSourceData.release(); m_currentRuleData = 0; + m_inStyleRuleOrDeclaration = false; } #ifdef ANDROID_INSTRUMENT android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); @@ -2095,7 +2098,7 @@ bool CSSParser::parseAnimationShorthand(bool important) CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection, CSSPropertyWebkitAnimationFillMode }; - const int numProperties = sizeof(properties) / sizeof(properties[0]); + const int numProperties = WTF_ARRAY_LENGTH(properties); ShorthandScope scope(this, CSSPropertyWebkitAnimation); @@ -2153,7 +2156,7 @@ bool CSSParser::parseTransitionShorthand(bool important) CSSPropertyWebkitTransitionDuration, CSSPropertyWebkitTransitionTimingFunction, CSSPropertyWebkitTransitionDelay }; - const int numProperties = sizeof(properties) / sizeof(properties[0]); + const int numProperties = WTF_ARRAY_LENGTH(properties); ShorthandScope scope(this, CSSPropertyWebkitTransition); @@ -2936,16 +2939,21 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationProperty() return 0; } -void CSSParser::parseTransformOriginShorthand(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) +bool CSSParser::parseTransformOriginShorthand(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3) { parseFillPosition(value1, value2); // now get z - if (m_valueList->current() && validUnit(m_valueList->current(), FLength, m_strict)) - value3 = CSSPrimitiveValue::create(m_valueList->current()->fValue, - (CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit); - if (value3) - m_valueList->next(); + if (m_valueList->current()) { + if (validUnit(m_valueList->current(), FLength, m_strict)) { + value3 = CSSPrimitiveValue::create(m_valueList->current()->fValue, + (CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit); + m_valueList->next(); + return true; + } + return false; + } + return true; } bool CSSParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result) @@ -3723,7 +3731,7 @@ bool CSSParser::parseFontFaceSrc() // There are two allowed functions: local() and format(). CSSParserValueList* args = val->function->args.get(); if (args && args->size() == 1) { - if (equalIgnoringCase(val->function->name, "local(") && !expectComma) { + if (equalIgnoringCase(val->function->name, "local(") && !expectComma && (args->current()->unit == CSSPrimitiveValue::CSS_STRING || args->current()->unit == CSSPrimitiveValue::CSS_IDENT)) { expectComma = true; allowFormat = false; CSSParserValue* a = args->current(); @@ -5103,7 +5111,8 @@ bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int switch (propId) { case CSSPropertyWebkitTransformOrigin: - parseTransformOriginShorthand(value, value2, value3); + if (!parseTransformOriginShorthand(value, value2, value3)) + return false; // parseTransformOriginShorthand advances the m_valueList pointer break; case CSSPropertyWebkitTransformOriginX: { @@ -5218,11 +5227,11 @@ int CSSParser::lex(void* yylvalWithoutType) length--; case DEGS: case RADS: - case KHERZ: + case KHERTZ: case REMS: length--; case MSECS: - case HERZ: + case HERTZ: case EMS: case EXS: case PXS: @@ -5567,6 +5576,7 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors) m_ruleRangeMap->set(result, m_currentRuleData.release()); m_currentRuleData = CSSRuleSourceData::create(); m_currentRuleData->styleSourceData = CSSStyleSourceData::create(); + m_inStyleRuleOrDeclaration = false; } } resetSelectorListMarks(); @@ -5720,6 +5730,7 @@ void CSSParser::markRuleBodyStart() ++offset; // Skip the rule body opening brace. if (offset > m_ruleBodyRange.start) m_ruleBodyRange.start = offset; + m_inStyleRuleOrDeclaration = true; } void CSSParser::markRuleBodyEnd() @@ -5731,11 +5742,15 @@ void CSSParser::markRuleBodyEnd() void CSSParser::markPropertyStart() { + if (!m_inStyleRuleOrDeclaration) + return; m_propertyRange.start = yytext - m_data; } void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed) { + if (!m_inStyleRuleOrDeclaration) + return; unsigned offset = yytext - m_data; if (*yytext == ';') // Include semicolon into the property text. ++offset; diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index 1da20b7..191249c 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -105,7 +105,7 @@ namespace WebCore { PassRefPtr<CSSValue> parseAnimationProperty(); PassRefPtr<CSSValue> parseAnimationTimingFunction(); - void parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&); + bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&); bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result); bool parseAnimationProperty(int propId, RefPtr<CSSValue>&); bool parseTransitionShorthand(bool important); @@ -230,6 +230,7 @@ namespace WebCore { AtomicString m_defaultNamespace; // tokenizer methods and data + bool m_inStyleRuleOrDeclaration; SourceRange m_selectorListRange; SourceRange m_ruleBodyRange; SourceRange m_propertyRange; diff --git a/WebCore/css/CSSPropertyLonghand.cpp b/WebCore/css/CSSPropertyLonghand.cpp index acca036..4df5d62 100644 --- a/WebCore/css/CSSPropertyLonghand.cpp +++ b/WebCore/css/CSSPropertyLonghand.cpp @@ -32,7 +32,7 @@ typedef HashMap<int, CSSPropertyLonghand> ShorthandMap; static void initShorthandMap(ShorthandMap& shorthandMap) { #define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \ - map.set(propID, CSSPropertyLonghand(array, sizeof(array) / sizeof(array[0]))) + map.set(propID, CSSPropertyLonghand(array, WTF_ARRAY_LENGTH(array))) // FIXME: The 'font' property has "shorthand nature" but is not parsed as a shorthand. diff --git a/WebCore/css/CSSRule.idl b/WebCore/css/CSSRule.idl index 82a1dee..170a801 100644 --- a/WebCore/css/CSSRule.idl +++ b/WebCore/css/CSSRule.idl @@ -22,6 +22,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, CustomToJS, Polymorphic ] CSSRule { diff --git a/WebCore/css/CSSStyleRule.idl b/WebCore/css/CSSStyleRule.idl index 4abfbfc..342aedd 100644 --- a/WebCore/css/CSSStyleRule.idl +++ b/WebCore/css/CSSStyleRule.idl @@ -21,7 +21,7 @@ module css { // Introduced in DOM Level 2: - interface CSSStyleRule : CSSRule { + interface [CustomMarkFunction] CSSStyleRule : CSSRule { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index a534247..0e49314 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -389,6 +389,9 @@ static CSSStyleSheet* simpleDefaultStyleSheet; RenderStyle* CSSStyleSelector::s_styleNotYetAvailable; static void loadFullDefaultStyle(); +#if ENABLE(FULLSCREEN_API) +static void loadFullScreenRulesIfNeeded(Document*); +#endif static void loadSimpleDefaultStyle(); // FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet. static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}"; @@ -427,8 +430,12 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee if (!defaultStyle) { if (!root || elementCanUseSimpleDefaultStyle(root)) loadSimpleDefaultStyle(); - else + else { loadFullDefaultStyle(); +#if ENABLE(FULLSCREEN_API) + loadFullScreenRulesIfNeeded(document); +#endif + } } // construct document root element default style. this is needed @@ -534,15 +541,20 @@ static void loadFullDefaultStyle() String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraQuirksStyleSheet(); CSSStyleSheet* quirksSheet = parseUASheet(quirksRules); defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval()); - +} + #if ENABLE(FULLSCREEN_API) +static void loadFullScreenRulesIfNeeded(Document* document) +{ + if (!document->webkitFullScreen()) + return; // Full-screen rules. String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet(); CSSStyleSheet* fullscreenSheet = parseUASheet(fullscreenRules); defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval()); defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval()); -#endif } +#endif static void loadSimpleDefaultStyle() { @@ -1141,8 +1153,12 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl m_style->setInsideLink(m_elementLinkState); } - if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) + if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) { loadFullDefaultStyle(); +#if ENABLE(FULLSCREEN_API) + loadFullScreenRulesIfNeeded(e->document()); +#endif + } #if ENABLE(SVG) static bool loadedSVGUserAgentSheet; @@ -7003,10 +7019,12 @@ void CSSStyleSelector::loadPendingImages() } case CSSPropertyWebkitBoxReflect: { - const NinePieceImage& maskImage = m_style->boxReflect()->mask(); - if (maskImage.image() && maskImage.image()->isPendingImage()) { - CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue(); - m_style->boxReflect()->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.slices(), maskImage.horizontalRule(), maskImage.verticalRule())); + if (StyleReflection* reflection = m_style->boxReflect()) { + const NinePieceImage& maskImage = reflection->mask(); + if (maskImage.image() && maskImage.image()->isPendingImage()) { + CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue(); + reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.slices(), maskImage.horizontalRule(), maskImage.verticalRule())); + } } break; } diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index 9bbcb8b..04df693 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -27,13 +27,30 @@ #include "CSSRuleList.h" #include "Document.h" #include "ExceptionCode.h" +#include "HTMLNames.h" #include "Node.h" +#include "SVGNames.h" #include "SecurityOrigin.h" #include "TextEncoding.h" #include <wtf/Deque.h> namespace WebCore { +#if !ASSERT_DISABLED +static bool isAcceptableCSSStyleSheetParent(Node* parentNode) +{ + // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document. + return !parentNode + || parentNode->isDocumentNode() + || parentNode->hasTagName(HTMLNames::linkTag) + || parentNode->hasTagName(HTMLNames::styleTag) +#if ENABLE(SVG) + || parentNode->hasTagName(SVGNames::styleTag) +#endif + || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; +} +#endif + CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset) : StyleSheet(parentSheet, href, baseURL) , m_document(parentSheet ? parentSheet->document() : 0) @@ -54,6 +71,7 @@ CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& b , m_isUserStyleSheet(false) , m_hasSyntacticallyValidCSSHeader(true) { + ASSERT(isAcceptableCSSStyleSheetParent(parentNode)); } CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset) diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index c757d51..fa2e099 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -480,7 +480,7 @@ static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f bool threeDEnabled = false; #if USE(ACCELERATED_COMPOSITING) if (RenderView* view = frame->contentRenderer()) - threeDEnabled = view->compositor()->hasAcceleratedCompositing(); + threeDEnabled = view->compositor()->canRender3DTransforms(); #endif returnValueIfNoParameter = threeDEnabled; diff --git a/WebCore/css/MediaQueryList.cpp b/WebCore/css/MediaQueryList.cpp new file mode 100644 index 0000000..aa3ef60 --- /dev/null +++ b/WebCore/css/MediaQueryList.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "MediaQueryList.h" + +#include "MediaList.h" +#include "MediaQueryEvaluator.h" +#include "MediaQueryListListener.h" +#include "MediaQueryMatcher.h" + +namespace WebCore { + +PassRefPtr<MediaQueryList> MediaQueryList::create(PassRefPtr<MediaQueryMatcher> vector, PassRefPtr<MediaList> media, bool matches) +{ + return adoptRef(new MediaQueryList(vector, media, matches)); +} + +MediaQueryList::MediaQueryList(PassRefPtr<MediaQueryMatcher> vector, PassRefPtr<MediaList> media, bool matches) + : m_matcher(vector) + , m_media(media) + , m_evaluationRound(m_matcher->evaluationRound()) + , m_changeRound(m_evaluationRound - 1) // m_evaluationRound and m_changeRound initial values must be different. + , m_matches(matches) +{ +} + +MediaQueryList::~MediaQueryList() +{ +} + +String MediaQueryList::media() const +{ + return m_media->mediaText(); +} + +void MediaQueryList::addListener(PassRefPtr<MediaQueryListListener> listener) +{ + if (!listener) + return; + + m_matcher->addListener(listener, this); +} + +void MediaQueryList::removeListener(PassRefPtr<MediaQueryListListener> listener) +{ + if (!listener) + return; + + m_matcher->removeListener(listener.get(), this); +} + +void MediaQueryList::evaluate(MediaQueryEvaluator* evaluator, bool& notificationNeeded) +{ + if (m_evaluationRound != m_matcher->evaluationRound() && evaluator) + setMatches(evaluator->eval(m_media.get())); + notificationNeeded = m_changeRound == m_matcher->evaluationRound(); +} + +void MediaQueryList::setMatches(bool newValue) +{ + m_evaluationRound = m_matcher->evaluationRound(); + + if (newValue == m_matches) + return; + + m_matches = newValue; + m_changeRound = m_evaluationRound; +} + +bool MediaQueryList::matches() +{ + if (m_evaluationRound != m_matcher->evaluationRound()) + setMatches(m_matcher->evaluate(m_media.get())); + return m_matches; +} + +} diff --git a/WebCore/css/MediaQueryList.h b/WebCore/css/MediaQueryList.h new file mode 100644 index 0000000..8ff4988 --- /dev/null +++ b/WebCore/css/MediaQueryList.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef MediaQueryList_h +#define MediaQueryList_h + +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class MediaList; +class MediaQueryListListener; +class MediaQueryEvaluator; +class MediaQueryMatcher; + +// MediaQueryList interface is specified at http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface +// The objects of this class are returned by window.matchMedia. They may be used to +// retrieve the current value of the given media query and to add/remove listeners that +// will be called whenever the value of the query changes. + +class MediaQueryList : public RefCounted<MediaQueryList> { +public: + static PassRefPtr<MediaQueryList> create(PassRefPtr<MediaQueryMatcher>, PassRefPtr<MediaList>, bool); + ~MediaQueryList(); + + String media() const; + bool matches(); + + void addListener(PassRefPtr<MediaQueryListListener>); + void removeListener(PassRefPtr<MediaQueryListListener>); + + void evaluate(MediaQueryEvaluator*, bool& notificationNeeded); + +private: + MediaQueryList(PassRefPtr<MediaQueryMatcher>, PassRefPtr<MediaList>, bool matches); + void setMatches(bool); + + RefPtr<MediaQueryMatcher> m_matcher; + RefPtr<MediaList> m_media; + unsigned m_evaluationRound; // Indicates if the query has been evaluated after the last style selector change. + unsigned m_changeRound; // Used to know if the query has changed in the last style selector change. + bool m_matches; +}; + +} + +#endif // MediaQueryList_h diff --git a/WebCore/css/MediaQueryList.idl b/WebCore/css/MediaQueryList.idl new file mode 100644 index 0000000..e775db8 --- /dev/null +++ b/WebCore/css/MediaQueryList.idl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +module view { + interface MediaQueryList { + readonly attribute DOMString media; + readonly attribute boolean matches; + void addListener(in MediaQueryListListener listener); + void removeListener(in MediaQueryListListener listener); + }; +} diff --git a/WebCore/css/MediaQueryListListener.cpp b/WebCore/css/MediaQueryListListener.cpp new file mode 100644 index 0000000..ab73b1d --- /dev/null +++ b/WebCore/css/MediaQueryListListener.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "MediaQueryListListener.h" + +#include "MediaQueryList.h" +#include "ScriptFunctionCall.h" + +#if USE(JSC) +#include "JSMediaQueryList.h" +#else +#include "V8MediaQueryList.h" +#endif + +namespace WebCore { + +void MediaQueryListListener::queryChanged(ScriptState* state, MediaQueryList* query) +{ + ScriptCallback callback(state, m_value); +#if USE(JSC) + callback.appendArgument(toJS(state, query)); +#else + callback.appendArgument(toV8(query)); +#endif + callback.call(); +} + +} diff --git a/WebCore/css/MediaQueryListListener.h b/WebCore/css/MediaQueryListListener.h new file mode 100644 index 0000000..de62683 --- /dev/null +++ b/WebCore/css/MediaQueryListListener.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef MediaQueryListListener_h +#define MediaQueryListListener_h + +#include "PlatformString.h" +#include "ScriptState.h" +#include "ScriptValue.h" + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class MediaQueryList; + +// See http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface + +class MediaQueryListListener : public RefCounted<MediaQueryListListener> { +public: + static PassRefPtr<MediaQueryListListener> create(ScriptValue value) + { + if (!value.isFunction()) + return 0; + return adoptRef(new MediaQueryListListener(value)); + } + void queryChanged(ScriptState*, MediaQueryList*); + + bool operator==(const MediaQueryListListener& other) const { return m_value == other.m_value; } + +private: + MediaQueryListListener(ScriptValue value) : m_value(value) { } + + ScriptValue m_value; +}; + +} + +#endif // MediaQueryListListener_h diff --git a/WebCore/css/MediaQueryListListener.idl b/WebCore/css/MediaQueryListListener.idl new file mode 100644 index 0000000..7031557 --- /dev/null +++ b/WebCore/css/MediaQueryListListener.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +module view { + interface [ + NoStaticTables, + ObjCProtocol, + PureInterface, + OmitConstructor + ] MediaQueryListListener { + void queryChanged(in MediaQueryList list); + }; +} diff --git a/WebCore/css/MediaQueryMatcher.cpp b/WebCore/css/MediaQueryMatcher.cpp new file mode 100644 index 0000000..e076837 --- /dev/null +++ b/WebCore/css/MediaQueryMatcher.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "MediaQueryMatcher.h" + +#include "CSSStyleSelector.h" +#include "Document.h" +#include "Element.h" +#include "FrameView.h" +#include "MediaList.h" +#include "MediaQueryEvaluator.h" +#include "MediaQueryList.h" +#include "MediaQueryListListener.h" + +namespace WebCore { + +MediaQueryMatcher::Listener::Listener(PassRefPtr<MediaQueryListListener> listener, PassRefPtr<MediaQueryList> query) + : m_listener(listener) + , m_query(query) +{ +} + +MediaQueryMatcher::Listener::~Listener() +{ +} + +void MediaQueryMatcher::Listener::evaluate(ScriptState* state, MediaQueryEvaluator* evaluator) +{ + bool notify; + m_query->evaluate(evaluator, notify); + if (notify) + m_listener->queryChanged(state, m_query.get()); +} + +MediaQueryMatcher::MediaQueryMatcher(Document* document) + : m_document(document) + , m_evaluationRound(1) +{ + ASSERT(m_document); +} + +MediaQueryMatcher::~MediaQueryMatcher() +{ +} + +void MediaQueryMatcher::documentDestroyed() +{ + m_listeners.clear(); + m_document = 0; +} + +String MediaQueryMatcher::mediaType() const +{ + if (!m_document || !m_document->frame() || !m_document->frame()->view()) + return String(); + + return m_document->frame()->view()->mediaType(); +} + +PassOwnPtr<MediaQueryEvaluator> MediaQueryMatcher::prepareEvaluator() const +{ + if (!m_document || !m_document->frame()) + return 0; + + Element* documentElement = m_document->documentElement(); + if (!documentElement) + return 0; + + CSSStyleSelector* styleSelector = m_document->styleSelector(); + if (!styleSelector) + return 0; + + RefPtr<RenderStyle> rootStyle = styleSelector->styleForElement(documentElement, 0 /*defaultParent*/, false /*allowSharing*/, true /*resolveForRootDefault*/); + + return adoptPtr(new MediaQueryEvaluator(mediaType(), m_document->frame(), rootStyle.get())); +} + +bool MediaQueryMatcher::evaluate(MediaList* media) +{ + if (!media) + return false; + + OwnPtr<MediaQueryEvaluator> evaluator(prepareEvaluator()); + return evaluator && evaluator->eval(media); +} + +PassRefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query) +{ + if (!m_document) + return 0; + + RefPtr<MediaList> media = MediaList::create(query, false); + return MediaQueryList::create(this, media, evaluate(media.get())); +} + +void MediaQueryMatcher::addListener(PassRefPtr<MediaQueryListListener> listener, PassRefPtr<MediaQueryList> query) +{ + if (!m_document) + return; + + for (size_t i = 0; i < m_listeners.size(); ++i) { + if (*m_listeners[i]->listener() == *listener && m_listeners[i]->query() == query) + return; + } + + m_listeners.append(new Listener(listener, query)); +} + +void MediaQueryMatcher::removeListener(MediaQueryListListener* listener, MediaQueryList* query) +{ + if (!m_document) + return; + + for (size_t i = 0; i < m_listeners.size(); ++i) { + if (*m_listeners[i]->listener() == *listener && m_listeners[i]->query() == query) { + m_listeners.remove(i); + return; + } + } +} + +void MediaQueryMatcher::styleSelectorChanged() +{ + ASSERT(m_document); + + ScriptState* scriptState = mainWorldScriptState(m_document->frame()); + if (!scriptState) + return; + + ++m_evaluationRound; + OwnPtr<MediaQueryEvaluator> evaluator = prepareEvaluator(); + if (!evaluator) + return; + + for (size_t i = 0; i < m_listeners.size(); ++i) + m_listeners[i]->evaluate(scriptState, evaluator.get()); +} + +} diff --git a/WebCore/css/MediaQueryMatcher.h b/WebCore/css/MediaQueryMatcher.h new file mode 100644 index 0000000..96bbf83 --- /dev/null +++ b/WebCore/css/MediaQueryMatcher.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef MediaQueryMatcher_h +#define MediaQueryMatcher_h + +#include "ScriptState.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class Document; +class MediaList; +class MediaQueryList; +class MediaQueryListListener; +class MediaQueryEvaluator; + +// MediaQueryMatcher class is responsible for keeping a vector of pairs +// MediaQueryList x MediaQueryListListener. It is responsible for evaluating the queries +// whenever it is needed and to call the listeners if the corresponding query has changed. +// The listeners must be called in the very same order in which they have been added. + +class MediaQueryMatcher : public RefCounted<MediaQueryMatcher> { +public: + static PassRefPtr<MediaQueryMatcher> create(Document* document) { return adoptRef(new MediaQueryMatcher(document)); } + ~MediaQueryMatcher(); + void documentDestroyed(); + + void addListener(PassRefPtr<MediaQueryListListener>, PassRefPtr<MediaQueryList>); + void removeListener(MediaQueryListListener*, MediaQueryList*); + + PassRefPtr<MediaQueryList> matchMedia(const String&); + + unsigned evaluationRound() const { return m_evaluationRound; } + void styleSelectorChanged(); + bool evaluate(MediaList*); + +private: + class Listener { + public: + Listener(PassRefPtr<MediaQueryListListener>, PassRefPtr<MediaQueryList>); + ~Listener(); + + void evaluate(ScriptState*, MediaQueryEvaluator*); + + MediaQueryListListener* listener() { return m_listener.get(); } + MediaQueryList* query() { return m_query.get(); } + + private: + RefPtr<MediaQueryListListener> m_listener; + RefPtr<MediaQueryList> m_query; + }; + + MediaQueryMatcher(Document*); + PassOwnPtr<MediaQueryEvaluator> prepareEvaluator() const; + String mediaType() const; + + Document* m_document; + Vector<OwnPtr<Listener> > m_listeners; + + // This value is incremented at style selector changes. + // It is used to avoid evaluating queries more then once and to make sure + // that a media query result change is notified exactly once. + unsigned m_evaluationRound; +}; + +} + +#endif // MediaQueryMatcher_h diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp index 854b63c..68a0772 100644 --- a/WebCore/css/StyleSheet.cpp +++ b/WebCore/css/StyleSheet.cpp @@ -20,29 +20,11 @@ #include "config.h" #include "StyleSheet.h" -#include "HTMLNames.h" #include "MediaList.h" #include "Node.h" -#include "SVGNames.h" namespace WebCore { -#if !ASSERT_DISABLED -static bool isAcceptableStyleSheetParent(Node* parentNode) -{ - // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document. - return !parentNode - || parentNode->isDocumentNode() - || parentNode->hasTagName(HTMLNames::linkTag) - || parentNode->hasTagName(HTMLNames::styleTag) - || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE -#if ENABLE(SVG) - || parentNode->hasTagName(SVGNames::styleTag) -#endif - ; -} -#endif - StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL) : StyleList(parentSheet) , m_parentNode(0) @@ -59,7 +41,6 @@ StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& , m_finalURL(finalURL) , m_disabled(false) { - ASSERT(isAcceptableStyleSheetParent(parentNode)); } StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL) @@ -75,6 +56,14 @@ StyleSheet::~StyleSheet() { if (m_media) m_media->setParent(0); + + // For style rules outside the document, .parentStyleSheet can become null even if the style rule + // is still observable from JavaScript. This matches the behavior of .parentNode for nodes, but + // it's not ideal because it makes the CSSOM's behavior depend on the timing of garbage collection. + for (unsigned i = 0; i < length(); ++i) { + ASSERT(item(i)->parent() == this); + item(i)->setParent(0); + } } StyleSheet* StyleSheet::parentStyleSheet() const diff --git a/WebCore/css/WebKitCSSKeyframeRule.idl b/WebCore/css/WebKitCSSKeyframeRule.idl index f6eac77..901b72a 100644 --- a/WebCore/css/WebKitCSSKeyframeRule.idl +++ b/WebCore/css/WebKitCSSKeyframeRule.idl @@ -29,7 +29,7 @@ module css { // Introduced in DOM Level ?: - interface WebKitCSSKeyframeRule : CSSRule { + interface [CustomMarkFunction] WebKitCSSKeyframeRule : CSSRule { attribute DOMString keyText; readonly attribute CSSStyleDeclaration style; diff --git a/WebCore/css/WebKitCSSKeyframesRule.idl b/WebCore/css/WebKitCSSKeyframesRule.idl index c40aff9..f97a2fe 100644 --- a/WebCore/css/WebKitCSSKeyframesRule.idl +++ b/WebCore/css/WebKitCSSKeyframesRule.idl @@ -30,6 +30,7 @@ module css { // Introduced in DOM Level ?: interface [ + CustomMarkFunction, HasIndexGetter ] WebKitCSSKeyframesRule : CSSRule { diff --git a/WebCore/css/html.css b/WebCore/css/html.css index d091806..3032302 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -725,6 +725,9 @@ a:-webkit-any-link:active { ruby, rt { text-indent: 0; /* blocks used for ruby rendering should not trigger this */ +} + +rt { line-height: normal; } diff --git a/WebCore/css/makeprop.pl b/WebCore/css/makeprop.pl index 64f5a6b..d394739 100644 --- a/WebCore/css/makeprop.pl +++ b/WebCore/css/makeprop.pl @@ -39,6 +39,10 @@ print GPERF << "EOF"; %{ /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */ #include \"CSSPropertyNames.h\" +#include \"HashTools.h\" +#include <string.h> + +namespace WebCore { %} %struct-type struct Property; @@ -51,7 +55,6 @@ struct Property; %define lookup-function-name findPropertyImpl %define hash-function-name propery_hash_function %define word-array-name property_wordlist -%includes %enum %% EOF @@ -61,8 +64,26 @@ foreach my $name (@names) { $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge; print GPERF $name . ", CSSProperty" . $id . "\n"; } -print GPERF "%%\n"; -close GPERF; + +print GPERF<< "EOF"; +%% +const Property* findProperty(register const char* str, register unsigned int len) +{ + return CSSPropertyNamesHash::findPropertyImpl(str, len); +} + +const char* getPropertyName(CSSPropertyID id) +{ + if (id < firstCSSProperty) + return 0; + int index = id - firstCSSProperty; + if (index >= numCSSProperties) + return 0; + return propertyNameStrings[index]; +} + +} // namespace WebCore +EOF open HEADER, ">CSSPropertyNames.h" || die "Could not open CSSPropertyNames.h for writing"; print HEADER << "EOF"; @@ -116,46 +137,4 @@ EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNamesHash.h") == 0 || die "calling gperf failed: $?"; - -open C, ">>CSSPropertyNamesHash.h" || die "Could not open CSSPropertyNamesHash.h for writing"; -print C << "EOF"; - -EOF - -close C; - -my $propertyNamesImpl = "CSSPropertyNames.cpp"; - -open PROPERTYNAMES, ">$propertyNamesImpl" || die "Could not open $propertyNamesImpl for writing"; -print PROPERTYNAMES << "EOF"; -/* This file is automatically generated by make-hash-tools.pl, do not edit */ - - -#include "CSSPropertyNames.h" -#include "HashTools.h" - -namespace WebCore { -#include "CSSPropertyNamesHash.h" - -const Property* findProperty (register const char* str, register unsigned int len) -{ - return CSSPropertyNamesHash::findPropertyImpl(str, len); -} - -const char* getPropertyName(CSSPropertyID id) -{ - if (id < firstCSSProperty) - return 0; - int index = id - firstCSSProperty; - if (index >= numCSSProperties) - return 0; - return propertyNameStrings[index]; -} - -} // namespace WebCore - -EOF - -close PROPERTYNAMES; - +system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; diff --git a/WebCore/css/makevalues.pl b/WebCore/css/makevalues.pl index c9f7f70..183cd35 100644 --- a/WebCore/css/makevalues.pl +++ b/WebCore/css/makevalues.pl @@ -40,6 +40,10 @@ print GPERF << "EOF"; /* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */ #include \"CSSValueKeywords.h\" +#include \"HashTools.h\" +#include <string.h> + +namespace WebCore { %} %struct-type struct Value; @@ -51,7 +55,6 @@ struct Value; %define lookup-function-name findValueImpl %define hash-function-name value_hash_function %define word-array-name value_word_list -%includes %enum %% EOF @@ -61,9 +64,38 @@ foreach my $name (@names) { $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge; print GPERF $name . ", CSSValue" . $id . "\n"; } -print GPERF "%%\n"; + +print GPERF << "EOF"; +%% +static const char* const valueList[] = { + "", +EOF + +foreach my $name (@names) { + print GPERF " \"" . $name . "\",\n"; +} + +print GPERF << "EOF"; + 0 +}; + +const Value* findValue(register const char* str, register unsigned int len) +{ + return CSSValueKeywordsHash::findValueImpl(str, len); +} + +const char* getValueName(unsigned short id) +{ + if (id >= numCSSValueKeywords || id <= 0) + return 0; + return valueList[id]; +} + +} // namespace WebCore +EOF close GPERF; + open HEADER, ">CSSValueKeywords.h" || die "Could not open CSSValueKeywords.h for writing"; print HEADER << "EOF"; /* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */ @@ -102,49 +134,4 @@ const char* getValueName(unsigned short id); EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywordsHash.h") == 0 || die "calling gperf failed: $?"; - -open C, ">>CSSValueKeywordsHash.h" || die "Could not open CSSValueKeywordsHash.h for writing"; -print C "static const char * const valueList[] = {\n"; -print C "\"\",\n"; -foreach my $name (@names) { - print C "\"" . $name . "\", \n"; -} -print C << "EOF"; - 0 -}; - -EOF - -close C; - -my $valueKeywordsImpl = "CSSValueKeywords.cpp"; - -open VALUEKEYWORDS, ">$valueKeywordsImpl" || die "Could not open $valueKeywordsImpl for writing"; -print VALUEKEYWORDS << "EOF"; -/* This file is automatically generated by make-hash-tools.pl, do not edit */ - -#include "CSSValueKeywords.h" -#include "HashTools.h" - -namespace WebCore { -#include "CSSValueKeywordsHash.h" - -const Value* findValue (register const char* str, register unsigned int len) -{ - return CSSValueKeywordsHash::findValueImpl(str, len); -} - -const char* getValueName(unsigned short id) -{ - if (id >= numCSSValueKeywords || id <= 0) - return 0; - return valueList[id]; -} - -} // namespace WebCore - -EOF - -close VALUEKEYWORDS; - +system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf > CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?"; diff --git a/WebCore/css/themeChromiumSkia.css b/WebCore/css/themeChromiumSkia.css new file mode 100644 index 0000000..bcd05f0 --- /dev/null +++ b/WebCore/css/themeChromiumSkia.css @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* These styles override other user-agent styles for Chromium using Skia. */ + +/* Option elements inherit their font (see themeWin.css). However, their + * font weight should always be normal, to distinguish from optgroup labels. */ +option { + font-weight: normal !important; +} diff --git a/WebCore/css/tokenizer.flex b/WebCore/css/tokenizer.flex index bd4808d..21ea247 100644 --- a/WebCore/css/tokenizer.flex +++ b/WebCore/css/tokenizer.flex @@ -99,8 +99,8 @@ nth [\+-]?{intnum}*n([\+-]{intnum})? {num}turn {yyTok = TURNS; return yyTok;} {num}ms {yyTok = MSECS; return yyTok;} {num}s {yyTok = SECS; return yyTok;} -{num}Hz {yyTok = HERZ; return yyTok;} -{num}kHz {yyTok = KHERZ; return yyTok;} +{num}Hz {yyTok = HERTZ; return yyTok;} +{num}kHz {yyTok = KHERTZ; return yyTok;} {num}{ident} {yyTok = DIMEN; return yyTok;} {num}%+ {yyTok = PERCENTAGE; return yyTok;} {intnum} {yyTok = INTEGER; return yyTok;} |