From 5ef7c8a6a70875d4430752d146bdcb069605d71d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 21 Aug 2012 10:57:44 +0200 Subject: Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147) New snapshot including various build fixes for newer Qt 5 --- Source/WebCore/css/CSSComputedStyleDeclaration.cpp | 93 ++-- Source/WebCore/css/CSSParser.cpp | 238 +++++---- Source/WebCore/css/CSSParser.h | 6 +- Source/WebCore/css/CSSPrimitiveValue.cpp | 48 +- Source/WebCore/css/CSSPrimitiveValueMappings.h | 553 +++++++++++---------- Source/WebCore/css/CSSProperty.cpp | 10 +- Source/WebCore/css/CSSPropertyNames.in | 6 + Source/WebCore/css/CSSSelector.cpp | 140 +++--- Source/WebCore/css/CSSStyleSheet.cpp | 33 +- Source/WebCore/css/CSSStyleSheet.h | 5 +- Source/WebCore/css/CSSValueKeywords.in | 6 +- Source/WebCore/css/CSSValueList.cpp | 20 +- Source/WebCore/css/CSSValueList.h | 4 +- .../WebCore/css/PropertySetCSSStyleDeclaration.cpp | 6 +- Source/WebCore/css/StyleBuilder.cpp | 45 +- Source/WebCore/css/StylePropertySet.cpp | 13 +- Source/WebCore/css/StyleResolver.cpp | 27 +- Source/WebCore/css/StyleResolver.h | 2 +- Source/WebCore/css/StyleRuleImport.cpp | 15 +- Source/WebCore/css/StyleSheetContents.cpp | 14 +- Source/WebCore/css/StyleSheetContents.h | 15 +- Source/WebCore/css/html.css | 29 +- Source/WebCore/css/makeprop.pl | 44 +- Source/WebCore/css/themeWin.css | 2 + 24 files changed, 763 insertions(+), 611 deletions(-) (limited to 'Source/WebCore/css') diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 7a050682d..902536762 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -57,6 +57,7 @@ #include "StylePropertyShorthand.h" #include "WebKitCSSTransformValue.h" #include "WebKitFontFamilyNames.h" +#include #if ENABLE(CSS_EXCLUSIONS) #include "CSSWrapShapes.h" @@ -176,7 +177,10 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyTabSize, CSSPropertyTextAlign, CSSPropertyTextDecoration, +#if ENABLE(CSS3_TEXT_DECORATION) CSSPropertyWebkitTextDecorationLine, + CSSPropertyWebkitTextDecorationStyle, +#endif // CSS3_TEXT_DECORATION CSSPropertyTextIndent, CSSPropertyTextRendering, CSSPropertyTextShadow, @@ -209,6 +213,9 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyWebkitBackgroundComposite, CSSPropertyWebkitBackgroundOrigin, CSSPropertyWebkitBackgroundSize, +#if ENABLE(CSS_COMPOSITING) + CSSPropertyWebkitBlendMode, +#endif CSSPropertyWebkitBorderFit, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderImage, @@ -707,12 +714,21 @@ static LayoutRect sizingBox(RenderObject* renderer) return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect(); } +static IntRect pixelSnappedSizingBox(RenderObject* renderer) +{ + if (!renderer->isBox()) + return IntRect(); + + RenderBox* box = toRenderBox(renderer); + return box->style()->boxSizing() == BORDER_BOX ? box->pixelSnappedBorderBoxRect() : pixelSnappedIntRect(box->computedCSSContentBoxRect()); +} + static PassRefPtr computedTransform(RenderObject* renderer, const RenderStyle* style) { if (!renderer || style->transform().operations().isEmpty()) return cssValuePool().createIdentifierValue(CSSValueNone); - LayoutRect box = sizingBox(renderer); + IntRect box = pixelSnappedSizingBox(renderer); TransformationMatrix transform; style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); @@ -1061,18 +1077,18 @@ void CSSComputedStyleDeclaration::deref() String CSSComputedStyleDeclaration::cssText() const { - String result(""); + StringBuilder result; for (unsigned i = 0; i < numComputedProperties; i++) { if (i) - result += " "; - result += getPropertyName(computedProperties[i]); - result += ": "; - result += getPropertyValue(computedProperties[i]); - result += ";"; + result.append(' '); + result.append(getPropertyName(computedProperties[i])); + result.append(": ", 2); + result.append(getPropertyValue(computedProperties[i])); + result.append(';'); } - return result; + return result.toString(); } void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec) @@ -1164,31 +1180,6 @@ static PassRefPtr valueForFamily(const AtomicString& family) return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING); } -static PassRefPtr renderUnicodeBidiFlagsToCSSValue(EUnicodeBidi unicodeBidi) -{ - switch (unicodeBidi) { - case UBNormal: - return cssValuePool().createIdentifierValue(CSSValueNormal); - case Embed: - return cssValuePool().createIdentifierValue(CSSValueEmbed); - case Plaintext: - return cssValuePool().createIdentifierValue(CSSValueWebkitPlaintext); - case Override: - return cssValuePool().createIdentifierValue(CSSValueBidiOverride); - case Isolate: - return cssValuePool().createIdentifierValue(CSSValueWebkitIsolate); - case OverrideIsolate: - { - RefPtr list = CSSValueList::createSpaceSeparated(); - list->append(cssValuePool().createIdentifierValue(CSSValueBidiOverride)); - list->append(cssValuePool().createIdentifierValue(CSSValueWebkitIsolate)); - return list; - } - } - ASSERT_NOT_REACHED(); - return 0; -} - static PassRefPtr renderTextDecorationFlagsToCSSValue(int textDecoration) { // Blink value is ignored. @@ -1205,6 +1196,27 @@ static PassRefPtr renderTextDecorationFlagsToCSSValue(int textDecorati return list; } +#if ENABLE(CSS3_TEXT_DECORATION) +static PassRefPtr renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle) +{ + switch (textDecorationStyle) { + case TextDecorationStyleSolid: + return cssValuePool().createIdentifierValue(CSSValueSolid); + case TextDecorationStyleDouble: + return cssValuePool().createIdentifierValue(CSSValueDouble); + case TextDecorationStyleDotted: + return cssValuePool().createIdentifierValue(CSSValueDotted); + case TextDecorationStyleDashed: + return cssValuePool().createIdentifierValue(CSSValueDashed); + case TextDecorationStyleWavy: + return cssValuePool().createIdentifierValue(CSSValueWavy); + } + + ASSERT_NOT_REACHED(); + return cssValuePool().createExplicitInitialValue(); +} +#endif // CSS3_TEXT_DECORATION + static PassRefPtr fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat) { // For backwards compatibility, if both values are equal, just return one of them. And @@ -1948,8 +1960,13 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyTextAlign: return cssValuePool().createValue(style->textAlign()); case CSSPropertyTextDecoration: + return renderTextDecorationFlagsToCSSValue(style->textDecoration()); +#if ENABLE(CSS3_TEXT_DECORATION) case CSSPropertyWebkitTextDecorationLine: return renderTextDecorationFlagsToCSSValue(style->textDecoration()); + case CSSPropertyWebkitTextDecorationStyle: + return renderTextDecorationStyleFlagsToCSSValue(style->textDecorationStyle()); +#endif // CSS3_TEXT_DECORATION case CSSPropertyWebkitTextDecorationsInEffect: return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect()); case CSSPropertyWebkitTextFillColor: @@ -2003,7 +2020,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyTop: return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document()->renderView()); case CSSPropertyUnicodeBidi: - return renderUnicodeBidiFlagsToCSSValue(style->unicodeBidi()); + return cssValuePool().createValue(style->unicodeBidi()); case CSSPropertyVerticalAlign: switch (style->verticalAlign()) { case BASELINE: @@ -2341,7 +2358,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert else if (animation->animationMode() == Animation::AnimateAll) propertyValue = cssValuePool().createIdentifierValue(CSSValueAll); else - propertyValue = cssValuePool().createValue(getPropertyName(animation->property()), CSSPrimitiveValue::CSS_STRING); + propertyValue = cssValuePool().createValue(getPropertyNameString(animation->property()), CSSPrimitiveValue::CSS_STRING); list->append(propertyValue); } } else @@ -2409,6 +2426,10 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert #if ENABLE(CSS_FILTERS) case CSSPropertyWebkitFilter: return valueForFilter(style.get()); +#endif +#if ENABLE(CSS_COMPOSITING) + case CSSPropertyWebkitBlendMode: + return cssValuePool().createValue(style->blendMode()); #endif case CSSPropertyBackground: return getBackgroundShorthandValue(); @@ -2617,7 +2638,7 @@ String CSSComputedStyleDeclaration::item(unsigned i) const if (i >= length()) return ""; - return getPropertyName(computedProperties[i]); + return getPropertyNameString(computedProperties[i]); } bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index aa08c18e7..4a2e38bb9 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -674,6 +674,15 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueVisible || valueID == CSSValueHidden) return true; break; +#if ENABLE(CSS_COMPOSITING) + case CSSPropertyWebkitBlendMode: + if (valueID == CSSValueNormal || valueID == CSSValueMultiply || valueID == CSSValueScreen || valueID == CSSValueOverlay + || valueID == CSSValueDarken || valueID == CSSValueLighten || valueID == CSSValueColorDodge || valueID == CSSValueColorBurn + || valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion + || valueID == CSSValueHue || valueID == CSSValueSaturation || valueID == CSSValueColor || valueID == CSSValueLuminosity) + return true; + break; +#endif case CSSPropertyWebkitBorderFit: if (valueID == CSSValueBorder || valueID == CSSValueLines) return true; @@ -918,6 +927,9 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyTextUnderlineStyle: case CSSPropertyVisibility: case CSSPropertyWebkitAppearance: +#if ENABLE(CSS_COMPOSITING) + case CSSPropertyWebkitBlendMode: +#endif case CSSPropertyWebkitBackfaceVisibility: case CSSPropertyWebkitBorderAfterStyle: case CSSPropertyWebkitBorderBeforeStyle: @@ -1041,7 +1053,7 @@ static bool parseTransformArguments(WebKitCSSTransformValue* transformValue, Cha return true; } -static bool parseTransformValue(StylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important) +static bool parseTranslateTransformValue(StylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important) { if (propertyID != CSSPropertyWebkitTransform) return false; @@ -1126,7 +1138,7 @@ bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID property return true; if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) return true; - if (parseTransformValue(declaration, propertyID, string, important)) + if (parseTranslateTransformValue(declaration, propertyID, string, important)) return true; CSSParserContext context(cssParserMode); @@ -1719,30 +1731,14 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) else return parseQuotes(propId, important); break; - case CSSPropertyUnicodeBidi: // normal | embed | (bidi-override || isolate) | plaintext | inherit + case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | isolate-override | plaintext | inherit if (id == CSSValueNormal || id == CSSValueEmbed + || id == CSSValueBidiOverride + || id == CSSValueWebkitIsolate + || id == CSSValueWebkitIsolateOverride || id == CSSValueWebkitPlaintext) validPrimitive = true; - else { - RefPtr list = CSSValueList::createSpaceSeparated(); - bool isValid = true; - while (isValid && value) { - switch (value->id) { - case CSSValueBidiOverride: - case CSSValueWebkitIsolate: - list->append(cssValuePool().createIdentifierValue(value->id)); - break; - default: - isValid = false; - } - value = m_valueList->next(); - } - if (list->length() && isValid) { - parsedValue = list.release(); - m_valueList->next(); - } - } break; case CSSPropertyContent: // [ | | | attr(X) | open-quote | @@ -2104,10 +2100,18 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) // none | [ underline || overline || line-through || blink ] | inherit return parseTextDecoration(propId, important); +#if ENABLE(CSS3_TEXT_DECORATION) case CSSPropertyWebkitTextDecorationLine: // none | [ underline || overline || line-through ] | inherit return parseTextDecoration(propId, important); + case CSSPropertyWebkitTextDecorationStyle: + // solid | double | dotted | dashed | wavy + if (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDotted || id == CSSValueDashed || id == CSSValueWavy) + validPrimitive = true; + break; +#endif // CSS3_TEXT_DECORATION + case CSSPropertyZoom: // normal | reset | document | | | inherit if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocument) validPrimitive = true; @@ -2255,6 +2259,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) } break; #endif +#if ENABLE(CSS_COMPOSITING) + case CSSPropertyWebkitBlendMode: + validPrimitive = true; + break; +#endif #if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlex: { ShorthandScope scope(this, propId); @@ -2320,7 +2329,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) if (id == CSSValueNone) validPrimitive = true; else { - RefPtr transformValue = parseTransform(m_valueList.get()); + RefPtr transformValue = parseTransform(); if (transformValue) { addProperty(propId, transformValue.release(), important); return true; @@ -7266,75 +7275,87 @@ private: CSSParser::Units m_unit; }; -PassRefPtr CSSParser::parseTransform(CSSParserValueList* valueList) +PassRefPtr CSSParser::parseTransform() { - if (!valueList) + if (!m_valueList) return 0; - // The transform is a list of functional primitives that specify transform operations. - // We collect a list of WebKitCSSTransformValues, where each value specifies a single operation. RefPtr list = CSSValueList::createSpaceSeparated(); - for (CSSParserValue* value = valueList->current(); value; value = valueList->next()) { - if (value->unit != CSSParserValue::Function || !value->function) + for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { + RefPtr parsedTransformValue = parseTransformValue(value); + if (!parsedTransformValue) return 0; - // Every primitive requires at least one argument. - CSSParserValueList* args = value->function->args.get(); - if (!args) - return 0; + list->append(parsedTransformValue.release()); + } - // See if the specified primitive is one we understand. - TransformOperationInfo info(value->function->name); - if (info.unknown()) - return 0; + return list.release(); +} + - if (!info.hasCorrectArgCount(args->size())) - return 0; +PassRefPtr CSSParser::parseTransformValue(CSSParserValue *value) +{ + if (value->unit != CSSParserValue::Function || !value->function) + return 0; - // Create the new WebKitCSSTransformValue for this operation and add it to our list. - RefPtr transformValue = WebKitCSSTransformValue::create(info.type()); - list->append(transformValue); + // Every primitive requires at least one argument. + CSSParserValueList* args = value->function->args.get(); + if (!args) + return 0; - // Snag our values. - CSSParserValue* a = args->current(); - unsigned argNumber = 0; - while (a) { - CSSParser::Units unit = info.unit(); + // See if the specified primitive is one we understand. + TransformOperationInfo info(value->function->name); + if (info.unknown()) + return 0; - if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation && argNumber == 3) { - // 4th param of rotate3d() is an angle rather than a bare number, validate it as such - if (!validUnit(a, FAngle, CSSStrictMode)) - return 0; - } else if (info.type() == WebKitCSSTransformValue::Translate3DTransformOperation && argNumber == 2) { - // 3rd param of translate3d() cannot be a percentage - if (!validUnit(a, FLength, CSSStrictMode)) - return 0; - } else if (info.type() == WebKitCSSTransformValue::TranslateZTransformOperation && argNumber == 0) { - // 1st param of translateZ() cannot be a percentage - if (!validUnit(a, FLength, CSSStrictMode)) - return 0; - } else if (info.type() == WebKitCSSTransformValue::PerspectiveTransformOperation && argNumber == 0) { - // 1st param of perspective() must be a non-negative number (deprecated) or length. - if (!validUnit(a, FNumber | FLength | FNonNeg, CSSStrictMode)) - return 0; - } else if (!validUnit(a, unit, CSSStrictMode)) - return 0; + if (!info.hasCorrectArgCount(args->size())) + return 0; + + // The transform is a list of functional primitives that specify transform operations. + // We collect a list of WebKitCSSTransformValues, where each value specifies a single operation. - // Add the value to the current transform operation. - transformValue->append(createPrimitiveNumericValue(a)); + // Create the new WebKitCSSTransformValue for this operation and add it to our list. + RefPtr transformValue = WebKitCSSTransformValue::create(info.type()); - a = args->next(); - if (!a) - break; - if (a->unit != CSSParserValue::Operator || a->iValue != ',') + // Snag our values. + CSSParserValue* a = args->current(); + unsigned argNumber = 0; + while (a) { + CSSParser::Units unit = info.unit(); + + if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation && argNumber == 3) { + // 4th param of rotate3d() is an angle rather than a bare number, validate it as such + if (!validUnit(a, FAngle, CSSStrictMode)) return 0; - a = args->next(); + } else if (info.type() == WebKitCSSTransformValue::Translate3DTransformOperation && argNumber == 2) { + // 3rd param of translate3d() cannot be a percentage + if (!validUnit(a, FLength, CSSStrictMode)) + return 0; + } else if (info.type() == WebKitCSSTransformValue::TranslateZTransformOperation && !argNumber) { + // 1st param of translateZ() cannot be a percentage + if (!validUnit(a, FLength, CSSStrictMode)) + return 0; + } else if (info.type() == WebKitCSSTransformValue::PerspectiveTransformOperation && !argNumber) { + // 1st param of perspective() must be a non-negative number (deprecated) or length. + if (!validUnit(a, FNumber | FLength | FNonNeg, CSSStrictMode)) + return 0; + } else if (!validUnit(a, unit, CSSStrictMode)) + return 0; - argNumber++; - } + // Add the value to the current transform operation. + transformValue->append(createPrimitiveNumericValue(a)); + + a = args->next(); + if (!a) + break; + if (a->unit != CSSParserValue::Operator || a->iValue != ',') + return 0; + a = args->next(); + + argNumber++; } - return list.release(); + return transformValue.release(); } bool CSSParser::isBlendMode(int ident) @@ -7556,26 +7577,36 @@ PassRefPtr CSSParser::parseCustomFilter(CSSParserValue* va if (!(arg = argsList->current())) return 0; - // TODO: Implement other parameters types parsing. - // textures: https://bugs.webkit.org/show_bug.cgi?id=71442 - // 3d-transforms: https://bugs.webkit.org/show_bug.cgi?id=71443 - // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 - RefPtr paramValueList = CSSValueList::createSpaceSeparated(); - while ((arg = argsList->current())) { - // If we hit a comma it means we finished this parameter's values. - if (isComma(arg)) - break; - if (!validUnit(arg, FNumber, CSSStrictMode)) + RefPtr parameterValue; + + if (arg->unit == CSSParserValue::Function && arg->function) + // TODO: Implement other parameters types parsing. + // textures: https://bugs.webkit.org/show_bug.cgi?id=71442 + // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 + // array: https://bugs.webkit.org/show_bug.cgi?id=94226 + // 3d-transform shall be the last to be checked + parameterValue = parseCustomFilterTransform(argsList); + else { + RefPtr paramValueList = CSSValueList::createSpaceSeparated(); + while ((arg = argsList->current())) { + // If we hit a comma it means we finished this parameter's values. + if (isComma(arg)) + break; + if (!validUnit(arg, FNumber, CSSStrictMode)) + return 0; + paramValueList->append(cssValuePool().createValue(arg->fValue, CSSPrimitiveValue::CSS_NUMBER)); + argsList->next(); + } + if (!paramValueList->length() || paramValueList->length() > 4) return 0; - paramValueList->append(cssValuePool().createValue(arg->fValue, CSSPrimitiveValue::CSS_NUMBER)); - argsList->next(); + parameterValue = paramValueList.release(); } - if (!paramValueList->length() || paramValueList->length() > 4) + + if (!parameterValue || !acceptCommaOperator(argsList)) return 0; - parameter->append(paramValueList.release()); + + parameter->append(parameterValue.release()); paramList->append(parameter.release()); - if (!acceptCommaOperator(argsList)) - return 0; } if (paramList->length()) @@ -7583,6 +7614,27 @@ PassRefPtr CSSParser::parseCustomFilter(CSSParserValue* va return filterValue; } + +PassRefPtr CSSParser::parseCustomFilterTransform(CSSParserValueList* valueList) +{ + if (!valueList) + return 0; + + // CSS Shaders' custom() transforms are space separated and comma terminated. + RefPtr list = CSSValueList::createSpaceSeparated(); + for (CSSParserValue* value = valueList->current(); value; value = valueList->next()) { + if (isComma(value)) + break; + + RefPtr parsedTransformValue = parseTransformValue(value); + if (!parsedTransformValue) + return 0; + + list->append(parsedTransformValue.release()); + } + + return list.release(); +} #endif PassRefPtr CSSParser::parseBuiltinFilterArguments(CSSParserValueList* args, WebKitCSSFilterValue::FilterOperationType filterType) @@ -7916,6 +7968,7 @@ bool CSSParser::parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& prop void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr value, bool important) { +#if ENABLE(CSS3_TEXT_DECORATION) // The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set. if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand == CSSPropertyInvalid) { for (unsigned i = 0; i < m_parsedProperties->size(); ++i) { @@ -7923,6 +7976,7 @@ void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtrid) { case CSSValueBlink: +#if ENABLE(CSS3_TEXT_DECORATION) // Blink value is not accepted by -webkit-text-decoration-line. isValid = propId != CSSPropertyWebkitTextDecorationLine; break; +#endif // CSS3_TEXT_DECORATION case CSSValueUnderline: case CSSValueOverline: case CSSValueLineThrough: diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index 5a1ed97b8..aec1f6635 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -219,13 +219,15 @@ public: #if ENABLE(CSS_SHADERS) PassRefPtr parseMixFunction(CSSParserValue*); PassRefPtr parseCustomFilter(CSSParserValue*); + PassRefPtr parseCustomFilterTransform(CSSParserValueList*); #endif #endif static bool isBlendMode(int ident); static bool isCompositeOperator(int ident); - PassRefPtr parseTransform(CSSParserValueList*); + PassRefPtr parseTransform(); + PassRefPtr parseTransformValue(CSSParserValue*); bool parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr&, RefPtr&, RefPtr&); bool parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, RefPtr&, RefPtr&); @@ -247,8 +249,6 @@ public: bool parseFontVariantLigatures(bool important); - int yyparse(); - CSSParserSelector* createFloatingSelector(); PassOwnPtr sinkFloatingSelector(CSSParserSelector*); diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp index 65ca80427..bbd6700d3 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.cpp +++ b/Source/WebCore/css/CSSPrimitiveValue.cpp @@ -207,15 +207,7 @@ static const AtomicString& valueOrPropertyName(int valueOrPropertyID) return keywordString; } - if (valueOrPropertyID >= firstCSSProperty && valueOrPropertyID < firstCSSProperty + numCSSProperties) { - static AtomicString* propertyStrings = new AtomicString[numCSSProperties]; // Leaked intentionally. - AtomicString& propertyString = propertyStrings[valueOrPropertyID - firstCSSProperty]; - if (propertyString.isNull()) - propertyString = getPropertyName(static_cast(valueOrPropertyID)); - return propertyString; - } - - return nullAtom; + return getPropertyNameAtomicString(static_cast(valueOrPropertyID)); } CSSPrimitiveValue::CSSPrimitiveValue(int ident) @@ -945,12 +937,9 @@ String CSSPrimitiveValue::customCssText() const text = valueOrPropertyName(m_value.ident); break; case CSS_ATTR: { - DEFINE_STATIC_LOCAL(const String, attrParen, ("attr(")); - StringBuilder result; result.reserveCapacity(6 + m_value.string->length()); - - result.append(attrParen); + result.appendLiteral("attr("); result.append(m_value.string); result.append(')'); @@ -963,22 +952,21 @@ String CSSPrimitiveValue::customCssText() const text += ")"; break; case CSS_COUNTER: { - DEFINE_STATIC_LOCAL(const String, counterParen, ("counter(")); - DEFINE_STATIC_LOCAL(const String, countersParen, ("counters(")); - DEFINE_STATIC_LOCAL(const String, commaSpace, (", ")); - StringBuilder result; String separator = m_value.counter->separator(); - result.append(separator.isEmpty() ? counterParen : countersParen); + if (separator.isEmpty()) + result.appendLiteral("counter("); + else + result.appendLiteral("counters("); result.append(m_value.counter->identifier()); if (!separator.isEmpty()) { - result.append(commaSpace); + result.appendLiteral(", "); result.append(quoteCSSStringIfNeeded(separator)); } String listStyle = m_value.counter->listStyle(); if (!listStyle.isEmpty()) { - result.append(commaSpace); + result.appendLiteral(", "); result.append(listStyle); } result.append(')'); @@ -987,26 +975,8 @@ String CSSPrimitiveValue::customCssText() const break; } case CSS_RECT: { - DEFINE_STATIC_LOCAL(const String, rectParen, ("rect(")); - Rect* rectVal = getRectValue(); - StringBuilder result; - result.reserveCapacity(32); - result.append(rectParen); - - result.append(rectVal->top()->cssText()); - result.append(' '); - - result.append(rectVal->right()->cssText()); - result.append(' '); - - result.append(rectVal->bottom()->cssText()); - result.append(' '); - - result.append(rectVal->left()->cssText()); - result.append(')'); - - text = result.toString(); + text = "rect(" + rectVal->top()->cssText() + ' ' + rectVal->right()->cssText() + ' ' + rectVal->bottom()->cssText() + ' ' + rectVal->left()->cssText() + ')'; break; } case CSS_QUAD: { diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index 6a337602b..14cef2595 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -192,10 +192,10 @@ template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const return PrintColorAdjustEconomy; case CSSValueExact: return PrintColorAdjustExact; - default: - ASSERT_NOT_REACHED(); - return PrintColorAdjustEconomy; } + + ASSERT_NOT_REACHED(); + return PrintColorAdjustEconomy; } @@ -330,10 +330,10 @@ template<> inline CSSPrimitiveValue::operator CompositeOperator() const return CompositePlusDarker; case CSSValuePlusLighter: return CompositePlusLighter; - default: - ASSERT_NOT_REACHED(); - return CompositeClear; } + + ASSERT_NOT_REACHED(); + return CompositeClear; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) @@ -553,10 +553,10 @@ template<> inline CSSPrimitiveValue::operator EBackfaceVisibility() const return BackfaceVisibilityVisible; case CSSValueHidden: return BackfaceVisibilityHidden; - default: - ASSERT_NOT_REACHED(); - return BackfaceVisibilityHidden; } + + ASSERT_NOT_REACHED(); + return BackfaceVisibilityHidden; } @@ -586,10 +586,10 @@ template<> inline CSSPrimitiveValue::operator EFillAttachment() const return LocalBackgroundAttachment; case CSSValueFixed: return FixedBackgroundAttachment; - default: - ASSERT_NOT_REACHED(); - return ScrollBackgroundAttachment; } + + ASSERT_NOT_REACHED(); + return ScrollBackgroundAttachment; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e) @@ -627,10 +627,10 @@ template<> inline CSSPrimitiveValue::operator EFillBox() const case CSSValueText: case CSSValueWebkitText: return TextFillBox; - default: - ASSERT_NOT_REACHED(); - return BorderFillBox; } + + ASSERT_NOT_REACHED(); + return BorderFillBox; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e) @@ -664,10 +664,10 @@ template<> inline CSSPrimitiveValue::operator EFillRepeat() const return RoundFill; case CSSValueSpace: return SpaceFill; - default: - ASSERT_NOT_REACHED(); - return RepeatFill; } + + ASSERT_NOT_REACHED(); + return RepeatFill; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxPack e) @@ -701,10 +701,10 @@ template<> inline CSSPrimitiveValue::operator EBoxPack() const return Center; case CSSValueJustify: return Justify; - default: - ASSERT_NOT_REACHED(); - return Justify; } + + ASSERT_NOT_REACHED(); + return Justify; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e) @@ -743,10 +743,10 @@ template<> inline CSSPrimitiveValue::operator EBoxAlignment() const return BCENTER; case CSSValueBaseline: return BBASELINE; - default: - ASSERT_NOT_REACHED(); - return BSTRETCH; } + + ASSERT_NOT_REACHED(); + return BSTRETCH; } #if ENABLE(CSS_BOX_DECORATION_BREAK) @@ -771,10 +771,10 @@ template<> inline CSSPrimitiveValue::operator EBoxDecorationBreak() const return DSLICE; case CSSValueClone: return DCLONE; - default: - ASSERT_NOT_REACHED(); - return DSLICE; } + + ASSERT_NOT_REACHED(); + return DSLICE; } #endif @@ -799,10 +799,10 @@ template<> inline CSSPrimitiveValue::operator EBoxSizing() const return BORDER_BOX; case CSSValueContentBox: return CONTENT_BOX; - default: - ASSERT_NOT_REACHED(); - return BORDER_BOX; } + + ASSERT_NOT_REACHED(); + return BORDER_BOX; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e) @@ -826,10 +826,10 @@ template<> inline CSSPrimitiveValue::operator EBoxDirection() const return BNORMAL; case CSSValueReverse: return BREVERSE; - default: - ASSERT_NOT_REACHED(); - return BNORMAL; } + + ASSERT_NOT_REACHED(); + return BNORMAL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e) @@ -853,10 +853,10 @@ template<> inline CSSPrimitiveValue::operator EBoxLines() const return SINGLE; case CSSValueMultiple: return MULTIPLE; - default: - ASSERT_NOT_REACHED(); - return SINGLE; } + + ASSERT_NOT_REACHED(); + return SINGLE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e) @@ -882,10 +882,10 @@ template<> inline CSSPrimitiveValue::operator EBoxOrient() const case CSSValueVertical: case CSSValueBlockAxis: return VERTICAL; - default: - ASSERT_NOT_REACHED(); - return HORIZONTAL; } + + ASSERT_NOT_REACHED(); + return HORIZONTAL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e) @@ -919,10 +919,10 @@ template<> inline CSSPrimitiveValue::operator ECaptionSide() const return CAPTOP; case CSSValueBottom: return CAPBOTTOM; - default: - ASSERT_NOT_REACHED(); - return CAPTOP; } + + ASSERT_NOT_REACHED(); + return CAPTOP; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e) @@ -956,10 +956,10 @@ template<> inline CSSPrimitiveValue::operator EClear() const return CRIGHT; case CSSValueBoth: return CBOTH; - default: - ASSERT_NOT_REACHED(); - return CNONE; } + + ASSERT_NOT_REACHED(); + return CNONE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e) @@ -1197,10 +1197,10 @@ template<> inline CSSPrimitiveValue::operator EEmptyCell() const return SHOW; case CSSValueHide: return HIDE; - default: - ASSERT_NOT_REACHED(); - return SHOW; } + + ASSERT_NOT_REACHED(); + return SHOW; } #if ENABLE(CSS3_FLEXBOX) @@ -1246,10 +1246,10 @@ template<> inline CSSPrimitiveValue::operator EAlignItems() const return AlignStretch; case CSSValueBaseline: return AlignBaseline; - default: - ASSERT_NOT_REACHED(); - return AlignFlexStart; } + + ASSERT_NOT_REACHED(); + return AlignFlexStart; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifyContent e) @@ -1288,10 +1288,10 @@ template<> inline CSSPrimitiveValue::operator EJustifyContent() const return JustifySpaceBetween; case CSSValueSpaceAround: return JustifySpaceAround; - default: - ASSERT_NOT_REACHED(); - return JustifyFlexStart; } + + ASSERT_NOT_REACHED(); + return JustifyFlexStart; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e) @@ -1325,10 +1325,10 @@ template<> inline CSSPrimitiveValue::operator EFlexDirection() const return FlowColumn; case CSSValueColumnReverse: return FlowColumnReverse; - default: - ASSERT_NOT_REACHED(); - return FlowRow; } + + ASSERT_NOT_REACHED(); + return FlowRow; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignContent e) @@ -1372,10 +1372,10 @@ template<> inline CSSPrimitiveValue::operator EAlignContent() const return AlignContentSpaceAround; case CSSValueStretch: return AlignContentStretch; - default: - ASSERT_NOT_REACHED(); - return AlignContentStretch; } + + ASSERT_NOT_REACHED(); + return AlignContentStretch; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e) @@ -1404,10 +1404,10 @@ template<> inline CSSPrimitiveValue::operator EFlexWrap() const return FlexWrap; case CSSValueWrapReverse: return FlexWrapReverse; - default: - ASSERT_NOT_REACHED(); - return FlexWrapNone; } + + ASSERT_NOT_REACHED(); + return FlexWrapNone; } #endif @@ -1439,10 +1439,10 @@ template<> inline CSSPrimitiveValue::operator EFloat() const case CSSValueNone: case CSSValueCenter: // Non-standard CSS value return NoFloat; - default: - ASSERT_NOT_REACHED(); - return NoFloat; } + + ASSERT_NOT_REACHED(); + return NoFloat; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e) @@ -1466,10 +1466,10 @@ template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const return AFTER_WHITE_SPACE; case CSSValueNormal: return LBNORMAL; - default: - ASSERT_NOT_REACHED(); - return LBNORMAL; } + + ASSERT_NOT_REACHED(); + return LBNORMAL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e) @@ -1493,10 +1493,10 @@ template<> inline CSSPrimitiveValue::operator EListStylePosition() const return OUTSIDE; case CSSValueInside: return INSIDE; - default: - ASSERT_NOT_REACHED(); - return OUTSIDE; } + + ASSERT_NOT_REACHED(); + return OUTSIDE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e) @@ -1786,10 +1786,10 @@ template<> inline CSSPrimitiveValue::operator EMarginCollapse() const return MSEPARATE; case CSSValueDiscard: return MDISCARD; - default: - ASSERT_NOT_REACHED(); - return MCOLLAPSE; } + + ASSERT_NOT_REACHED(); + return MCOLLAPSE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e) @@ -1823,10 +1823,10 @@ template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const return MSLIDE; case CSSValueAlternate: return MALTERNATE; - default: - ASSERT_NOT_REACHED(); - return MNONE; } + + ASSERT_NOT_REACHED(); + return MNONE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RegionOverflow e) @@ -1850,10 +1850,10 @@ template<> inline CSSPrimitiveValue::operator RegionOverflow() const return AutoRegionOverflow; case CSSValueBreak: return BreakRegionOverflow; - default: - ASSERT_NOT_REACHED(); - return AutoRegionOverflow; } + + ASSERT_NOT_REACHED(); + return AutoRegionOverflow; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e) @@ -1904,10 +1904,10 @@ template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const return MLEFT; case CSSValueRight: return MRIGHT; - default: - ASSERT_NOT_REACHED(); - return MAUTO; } + + ASSERT_NOT_REACHED(); + return MAUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e) @@ -1931,10 +1931,10 @@ template<> inline CSSPrimitiveValue::operator ENBSPMode() const return SPACE; case CSSValueNormal: return NBNORMAL; - default: - ASSERT_NOT_REACHED(); - return NBNORMAL; } + + ASSERT_NOT_REACHED(); + return NBNORMAL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e) @@ -1978,10 +1978,10 @@ template<> inline CSSPrimitiveValue::operator EOverflow() const return OMARQUEE; case CSSValueOverlay: return OOVERLAY; - default: - ASSERT_NOT_REACHED(); - return OVISIBLE; } + + ASSERT_NOT_REACHED(); + return OVISIBLE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e) @@ -2012,10 +2012,10 @@ template<> inline CSSPrimitiveValue::operator EPageBreak() const return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always." case CSSValueAvoid: return PBAVOID; - default: - ASSERT_NOT_REACHED(); - return PBAUTO; } + + ASSERT_NOT_REACHED(); + return PBAUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e) @@ -2058,10 +2058,10 @@ template<> inline CSSPrimitiveValue::operator EPosition() const case CSSValueWebkitSticky: return StickyPosition; #endif - default: - ASSERT_NOT_REACHED(); - return StaticPosition; } + + ASSERT_NOT_REACHED(); + return StaticPosition; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e) @@ -2098,10 +2098,10 @@ template<> inline CSSPrimitiveValue::operator EResize() const return RESIZE_NONE; case CSSValueNone: return RESIZE_NONE; - default: - ASSERT_NOT_REACHED(); - return RESIZE_NONE; } + + ASSERT_NOT_REACHED(); + return RESIZE_NONE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e) @@ -2125,10 +2125,10 @@ template<> inline CSSPrimitiveValue::operator ETableLayout() const return TFIXED; case CSSValueAuto: return TAUTO; - default: - ASSERT_NOT_REACHED(); - return TAUTO; } + + ASSERT_NOT_REACHED(); + return TAUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e) @@ -2192,11 +2192,32 @@ template<> inline CSSPrimitiveValue::operator ETextDecoration() const return LINE_THROUGH; case CSSValueBlink: return BLINK; - default: - ASSERT_NOT_REACHED(); - return TDNONE; } + + ASSERT_NOT_REACHED(); + return TDNONE; +} + +#if ENABLE(CSS3_TEXT_DECORATION) +template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const +{ + switch (m_value.ident) { + case CSSValueSolid: + return TextDecorationStyleSolid; + case CSSValueDouble: + return TextDecorationStyleDouble; + case CSSValueDotted: + return TextDecorationStyleDotted; + case CSSValueDashed: + return TextDecorationStyleDashed; + case CSSValueWavy: + return TextDecorationStyleWavy; + } + + ASSERT_NOT_REACHED(); + return TextDecorationStyleSolid; } +#endif // CSS3_TEXT_DECORATION template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e) : CSSValue(PrimitiveClass) @@ -2229,10 +2250,10 @@ template<> inline CSSPrimitiveValue::operator ETextSecurity() const return TSCIRCLE; case CSSValueSquare: return TSSQUARE; - default: - ASSERT_NOT_REACHED(); - return TSNONE; } + + ASSERT_NOT_REACHED(); + return TSNONE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e) @@ -2266,9 +2287,35 @@ template<> inline CSSPrimitiveValue::operator ETextTransform() const return LOWERCASE; case CSSValueNone: return TTNONE; - default: - ASSERT_NOT_REACHED(); - return TTNONE; + } + + ASSERT_NOT_REACHED(); + return TTNONE; +} + +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e) + : CSSValue(PrimitiveClass) +{ + m_primitiveUnitType = CSS_IDENT; + switch (e) { + case UBNormal: + m_value.ident = CSSValueNormal; + break; + case Embed: + m_value.ident = CSSValueEmbed; + break; + case Override: + m_value.ident = CSSValueBidiOverride; + break; + case Isolate: + m_value.ident = CSSValueWebkitIsolate; + break; + case IsolateOverride: + m_value.ident = CSSValueWebkitIsolateOverride; + break; + case Plaintext: + m_value.ident = CSSValueWebkitPlaintext; + break; } } @@ -2283,12 +2330,14 @@ template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const return Override; case CSSValueWebkitIsolate: return Isolate; + case CSSValueWebkitIsolateOverride: + return IsolateOverride; case CSSValueWebkitPlaintext: return Plaintext; - default: - ASSERT_NOT_REACHED(); - return UBNormal; } + + ASSERT_NOT_REACHED(); + return UBNormal; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e) @@ -2317,10 +2366,10 @@ template<> inline CSSPrimitiveValue::operator EUserDrag() const return DRAG_NONE; case CSSValueElement: return DRAG_ELEMENT; - default: - ASSERT_NOT_REACHED(); - return DRAG_AUTO; } + + ASSERT_NOT_REACHED(); + return DRAG_AUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e) @@ -2349,10 +2398,10 @@ template<> inline CSSPrimitiveValue::operator EUserModify() const return READ_WRITE; case CSSValueReadWritePlaintextOnly: return READ_WRITE_PLAINTEXT_ONLY; - default: - ASSERT_NOT_REACHED(); - return READ_ONLY; } + + ASSERT_NOT_REACHED(); + return READ_ONLY; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e) @@ -2383,10 +2432,10 @@ template<> inline CSSPrimitiveValue::operator EUserSelect() const return SELECT_TEXT; case CSSValueAll: return SELECT_ALL; - default: - ASSERT_NOT_REACHED(); - return SELECT_TEXT; } + + ASSERT_NOT_REACHED(); + return SELECT_TEXT; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVerticalAlign a) @@ -2447,10 +2496,10 @@ template<> inline CSSPrimitiveValue::operator EVerticalAlign() const return SUPER; case CSSValueWebkitBaselineMiddle: return BASELINE_MIDDLE; - default: - ASSERT_NOT_REACHED(); - return TOP; } + + ASSERT_NOT_REACHED(); + return TOP; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e) @@ -2479,10 +2528,10 @@ template<> inline CSSPrimitiveValue::operator EVisibility() const return VISIBLE; case CSSValueCollapse: return COLLAPSE; - default: - ASSERT_NOT_REACHED(); - return VISIBLE; } + + ASSERT_NOT_REACHED(); + return VISIBLE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e) @@ -2526,10 +2575,10 @@ template<> inline CSSPrimitiveValue::operator EWhiteSpace() const return PRE_LINE; case CSSValueNormal: return NORMAL; - default: - ASSERT_NOT_REACHED(); - return NORMAL; } + + ASSERT_NOT_REACHED(); + return NORMAL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e) @@ -2558,10 +2607,10 @@ template<> inline CSSPrimitiveValue::operator EWordBreak() const return BreakWordBreak; case CSSValueNormal: return NormalWordBreak; - default: - ASSERT_NOT_REACHED(); - return NormalWordBreak; } + + ASSERT_NOT_REACHED(); + return NormalWordBreak; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e) @@ -2585,10 +2634,10 @@ template<> inline CSSPrimitiveValue::operator EWordWrap() const return BreakWordWrap; case CSSValueNormal: return NormalWordWrap; - default: - ASSERT_NOT_REACHED(); - return NormalWordWrap; } + + ASSERT_NOT_REACHED(); + return NormalWordWrap; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e) @@ -2612,10 +2661,10 @@ template<> inline CSSPrimitiveValue::operator TextDirection() const return LTR; case CSSValueRtl: return RTL; - default: - ASSERT_NOT_REACHED(); - return LTR; } + + ASSERT_NOT_REACHED(); + return LTR; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e) @@ -2649,10 +2698,10 @@ template<> inline CSSPrimitiveValue::operator WritingMode() const return LeftToRightWritingMode; case CSSValueHorizontalBt: return BottomToTopWritingMode; - default: - ASSERT_NOT_REACHED(); - return TopToBottomWritingMode; } + + ASSERT_NOT_REACHED(); + return TopToBottomWritingMode; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e) @@ -2676,10 +2725,10 @@ template<> inline CSSPrimitiveValue::operator TextCombine() const return TextCombineNone; case CSSValueHorizontal: return TextCombineHorizontal; - default: - ASSERT_NOT_REACHED(); - return TextCombineNone; } + + ASSERT_NOT_REACHED(); + return TextCombineNone; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position) @@ -2703,10 +2752,10 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const return TextEmphasisPositionOver; case CSSValueUnder: return TextEmphasisPositionUnder; - default: - ASSERT_NOT_REACHED(); - return TextEmphasisPositionOver; } + + ASSERT_NOT_REACHED(); + return TextEmphasisPositionOver; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow) @@ -2730,10 +2779,10 @@ template<> inline CSSPrimitiveValue::operator TextOverflow() const return TextOverflowClip; case CSSValueEllipsis: return TextOverflowEllipsis; - default: - ASSERT_NOT_REACHED(); - return TextOverflowClip; } + + ASSERT_NOT_REACHED(); + return TextOverflowClip; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill) @@ -2757,10 +2806,10 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const return TextEmphasisFillFilled; case CSSValueOpen: return TextEmphasisFillOpen; - default: - ASSERT_NOT_REACHED(); - return TextEmphasisFillFilled; } + + ASSERT_NOT_REACHED(); + return TextEmphasisFillFilled; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark) @@ -2807,10 +2856,10 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const return TextEmphasisMarkTriangle; case CSSValueSesame: return TextEmphasisMarkSesame; - default: - ASSERT_NOT_REACHED(); - return TextEmphasisMarkNone; } + + ASSERT_NOT_REACHED(); + return TextEmphasisMarkNone; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e) @@ -2834,10 +2883,10 @@ template<> inline CSSPrimitiveValue::operator TextOrientation() const return TextOrientationVerticalRight; case CSSValueUpright: return TextOrientationUpright; - default: - ASSERT_NOT_REACHED(); - return TextOrientationVerticalRight; } + + ASSERT_NOT_REACHED(); + return TextOrientationVerticalRight; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e) @@ -2901,10 +2950,10 @@ template<> inline CSSPrimitiveValue::operator EPointerEvents() const return PE_FILL; case CSSValueStroke: return PE_STROKE; - default: - ASSERT_NOT_REACHED(); - return PE_ALL; } + + ASSERT_NOT_REACHED(); + return PE_ALL; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning) @@ -3142,10 +3191,10 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const return OptimizeLegibility; case CSSValueGeometricprecision: return GeometricPrecision; - default: - ASSERT_NOT_REACHED(); - return AutoTextRendering; } + + ASSERT_NOT_REACHED(); + return AutoTextRendering; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space) @@ -3174,10 +3223,10 @@ template<> inline CSSPrimitiveValue::operator ColorSpace() const return ColorSpaceDeviceRGB; case CSSValueSrgb: return ColorSpaceSRGB; - default: - ASSERT_NOT_REACHED(); - return ColorSpaceDeviceRGB; } + + ASSERT_NOT_REACHED(); + return ColorSpaceDeviceRGB; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens) @@ -3206,10 +3255,10 @@ template<> inline CSSPrimitiveValue::operator Hyphens() const return HyphensManual; case CSSValueAuto: return HyphensAuto; - default: - ASSERT_NOT_REACHED(); - return HyphensAuto; } + + ASSERT_NOT_REACHED(); + return HyphensAuto; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineSnap gridSnap) @@ -3238,10 +3287,10 @@ template<> inline CSSPrimitiveValue::operator LineSnap() const return LineSnapBaseline; case CSSValueContain: return LineSnapContain; - default: - ASSERT_NOT_REACHED(); - return LineSnapNone; } + + ASSERT_NOT_REACHED(); + return LineSnapNone; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineAlign lineAlign) @@ -3265,10 +3314,10 @@ template<> inline CSSPrimitiveValue::operator LineAlign() const return LineAlignNone; case CSSValueEdges: return LineAlignEdges; - default: - ASSERT_NOT_REACHED(); - return LineAlignNone; } + + ASSERT_NOT_REACHED(); + return LineAlignNone; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e) @@ -3304,10 +3353,10 @@ template<> inline CSSPrimitiveValue::operator Order() const return LogicalOrder; case CSSValueVisual: return VisualOrder; - default: - ASSERT_NOT_REACHED(); - return LogicalOrder; } + + ASSERT_NOT_REACHED(); + return LogicalOrder; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e) @@ -3339,10 +3388,10 @@ template<> inline CSSPrimitiveValue::operator ESpeak() const return SpeakLiteralPunctuation; case CSSValueNoPunctuation: return SpeakNoPunctuation; - default: - ASSERT_NOT_REACHED(); - return SpeakNormal; } + + ASSERT_NOT_REACHED(); + return SpeakNormal; } #if ENABLE(CSS_SHADERS) @@ -3377,10 +3426,10 @@ template<> inline CSSPrimitiveValue::operator CustomFilterOperation::MeshBoxType return CustomFilterOperation::PADDING_BOX; case CSSValueContentBox: return CustomFilterOperation::CONTENT_BOX; - default: - ASSERT_NOT_REACHED(); - return CustomFilterOperation::FILTER_BOX; } + + ASSERT_NOT_REACHED(); + return CustomFilterOperation::FILTER_BOX; } #endif // ENABLE(CSS_SHADERS) @@ -3475,10 +3524,10 @@ template<> inline CSSPrimitiveValue::operator BlendMode() const return BlendModeColor; case CSSValueLuminosity: return BlendModeLuminosity; - default: - ASSERT_NOT_REACHED(); - return BlendModeNormal; } + + ASSERT_NOT_REACHED(); + return BlendModeNormal; } #if ENABLE(SVG) @@ -3509,10 +3558,10 @@ template<> inline CSSPrimitiveValue::operator LineCap() const return RoundCap; case CSSValueSquare: return SquareCap; - default: - ASSERT_NOT_REACHED(); - return ButtCap; } + + ASSERT_NOT_REACHED(); + return ButtCap; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e) @@ -3541,10 +3590,10 @@ template<> inline CSSPrimitiveValue::operator LineJoin() const return RoundJoin; case CSSValueBevel: return BevelJoin; - default: - ASSERT_NOT_REACHED(); - return MiterJoin; } + + ASSERT_NOT_REACHED(); + return MiterJoin; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e) @@ -3568,10 +3617,10 @@ template<> inline CSSPrimitiveValue::operator WindRule() const return RULE_NONZERO; case CSSValueEvenodd: return RULE_EVENODD; - default: - ASSERT_NOT_REACHED(); - return RULE_NONZERO; } + + ASSERT_NOT_REACHED(); + return RULE_NONZERO; } @@ -3646,10 +3695,10 @@ template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const return AB_HANGING; case CSSValueMathematical: return AB_MATHEMATICAL; - default: - ASSERT_NOT_REACHED(); - return AB_AUTO; } + + ASSERT_NOT_REACHED(); + return AB_AUTO; } #endif @@ -3675,10 +3724,10 @@ template<> inline CSSPrimitiveValue::operator EBorderCollapse() const return BSEPARATE; case CSSValueCollapse: return BCOLLAPSE; - default: - ASSERT_NOT_REACHED(); - return BSEPARATE; } + + ASSERT_NOT_REACHED(); + return BSEPARATE; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderFit e) @@ -3702,10 +3751,10 @@ template<> inline CSSPrimitiveValue::operator EBorderFit() const return BorderFitBorder; case CSSValueLines: return BorderFitLines; - default: - ASSERT_NOT_REACHED(); - return BorderFitLines; } + + ASSERT_NOT_REACHED(); + return BorderFitLines; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e) @@ -3739,10 +3788,10 @@ template<> inline CSSPrimitiveValue::operator EImageRendering() const return ImageRenderingOptimizeQuality; case CSSValueWebkitOptimizeContrast: return ImageRenderingOptimizeContrast; - default: - ASSERT_NOT_REACHED(); - return ImageRenderingAuto; } + + ASSERT_NOT_REACHED(); + return ImageRenderingAuto; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETransformStyle3D e) @@ -3766,10 +3815,10 @@ template<> inline CSSPrimitiveValue::operator ETransformStyle3D() const return TransformStyle3DFlat; case CSSValuePreserve3d: return TransformStyle3DPreserve3D; - default: - ASSERT_NOT_REACHED(); - return TransformStyle3DFlat; } + + ASSERT_NOT_REACHED(); + return TransformStyle3DFlat; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnAxis e) @@ -3798,10 +3847,10 @@ template<> inline CSSPrimitiveValue::operator ColumnAxis() const return VerticalColumnAxis; case CSSValueAuto: return AutoColumnAxis; - default: - ASSERT_NOT_REACHED(); - return AutoColumnAxis; } + + ASSERT_NOT_REACHED(); + return AutoColumnAxis; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnProgression e) @@ -3825,10 +3874,10 @@ template<> inline CSSPrimitiveValue::operator ColumnProgression() const return NormalColumnProgression; case CSSValueReverse: return ReverseColumnProgression; - default: - ASSERT_NOT_REACHED(); - return NormalColumnProgression; } + + ASSERT_NOT_REACHED(); + return NormalColumnProgression; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapFlow wrapFlow) @@ -3872,10 +3921,10 @@ template<> inline CSSPrimitiveValue::operator WrapFlow() const return WrapFlowMaximum; case CSSValueClear: return WrapFlowClear; - default: - ASSERT_NOT_REACHED(); - return WrapFlowAuto; } + + ASSERT_NOT_REACHED(); + return WrapFlowAuto; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapThrough wrapThrough) @@ -3899,10 +3948,10 @@ template<> inline CSSPrimitiveValue::operator WrapThrough() const return WrapThroughWrap; case CSSValueNone: return WrapThroughNone; - default: - ASSERT_NOT_REACHED(); - return WrapThroughWrap; } + + ASSERT_NOT_REACHED(); + return WrapThroughWrap; } enum LengthConversion { @@ -3965,10 +4014,10 @@ template<> inline CSSPrimitiveValue::operator EColorInterpolation() const return CI_LINEARRGB; case CSSValueAuto: return CI_AUTO; - default: - ASSERT_NOT_REACHED(); - return CI_AUTO; } + + ASSERT_NOT_REACHED(); + return CI_AUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e) @@ -3997,10 +4046,10 @@ template<> inline CSSPrimitiveValue::operator EColorRendering() const return CR_OPTIMIZEQUALITY; case CSSValueAuto: return CR_AUTO; - default: - ASSERT_NOT_REACHED(); - return CR_AUTO; } + + ASSERT_NOT_REACHED(); + return CR_AUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e) @@ -4074,10 +4123,10 @@ template<> inline CSSPrimitiveValue::operator EDominantBaseline() const return DB_TEXT_AFTER_EDGE; case CSSValueTextBeforeEdge: return DB_TEXT_BEFORE_EDGE; - default: - ASSERT_NOT_REACHED(); - return DB_AUTO; } + + ASSERT_NOT_REACHED(); + return DB_AUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e) @@ -4111,10 +4160,10 @@ template<> inline CSSPrimitiveValue::operator EShapeRendering() const return SR_CRISPEDGES; case CSSValueGeometricprecision: return SR_GEOMETRICPRECISION; - default: - ASSERT_NOT_REACHED(); - return SR_AUTO; } + + ASSERT_NOT_REACHED(); + return SR_AUTO; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e) @@ -4143,10 +4192,10 @@ template<> inline CSSPrimitiveValue::operator ETextAnchor() const return TA_MIDDLE; case CSSValueEnd: return TA_END; - default: - ASSERT_NOT_REACHED(); - return TA_START; } + + ASSERT_NOT_REACHED(); + return TA_START; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e) @@ -4190,10 +4239,10 @@ template<> inline CSSPrimitiveValue::operator SVGWritingMode() const return WM_TBRL; case CSSValueTb: return WM_TB; - default: - ASSERT_NOT_REACHED(); - return WM_LRTB; } + + ASSERT_NOT_REACHED(); + return WM_LRTB; } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e) @@ -4217,10 +4266,10 @@ template<> inline CSSPrimitiveValue::operator EVectorEffect() const return VE_NONE; case CSSValueNonScalingStroke: return VE_NON_SCALING_STROKE; - default: - ASSERT_NOT_REACHED(); - return VE_NONE; } + + ASSERT_NOT_REACHED(); + return VE_NONE; } #endif // ENABLE(SVG) @@ -4266,10 +4315,10 @@ template<> inline CSSPrimitiveValue::operator ImageOrientationEnum() const return OriginBottomRight; case 3: return OriginLeftBottom; - default: - ASSERT_NOT_REACHED(); - return OriginTopLeft; } + + ASSERT_NOT_REACHED(); + return OriginTopLeft; } #endif // ENABLE(CSS_IMAGE_ORIENTATION) diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index 0b87cea30..9bc8966c1 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -48,7 +48,7 @@ String CSSProperty::cssName() const return "-webkit-var-" + static_cast(value())->name(); } #endif - return String(getPropertyName(id())); + return getPropertyNameString(id()); } String CSSProperty::cssText() const @@ -340,7 +340,9 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWebkitPrintColorAdjust: case CSSPropertyWebkitRtlOrdering: case CSSPropertyWebkitTextCombine: +#if ENABLE(CSS3_TEXT_DECORATION) case CSSPropertyWebkitTextDecorationLine: +#endif // CSS3_TEXT_DECORATION case CSSPropertyWebkitTextDecorationsInEffect: case CSSPropertyWebkitTextEmphasis: case CSSPropertyWebkitTextEmphasisColor: @@ -567,6 +569,9 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) #if ENABLE(CSS_FILTERS) case CSSPropertyWebkitFilter: #endif +#if ENABLE(CSS_COMPOSITING) + case CSSPropertyWebkitBlendMode: +#endif #if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitAlignContent: case CSSPropertyWebkitAlignItems: @@ -635,6 +640,9 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWebkitPerspectiveOrigin: case CSSPropertyWebkitPerspectiveOriginX: case CSSPropertyWebkitPerspectiveOriginY: +#if ENABLE(CSS3_TEXT_DECORATION) + case CSSPropertyWebkitTextDecorationStyle: +#endif // CSS3_TEXT_DECORATION case CSSPropertyWebkitTransform: case CSSPropertyWebkitTransformOrigin: case CSSPropertyWebkitTransformOriginX: diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index 0ee20df2b..685f350ad 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -266,6 +266,9 @@ z-index #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS -webkit-filter #endif +#if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING +-webkit-blend-mode +#endif #if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX -webkit-align-content -webkit-align-items @@ -351,7 +354,10 @@ z-index -webkit-rtl-ordering -webkit-text-combine -epub-text-combine = -webkit-text-combine +#if defined(ENABLE_CSS3_TEXT_DECORATION) && ENABLE_CSS3_TEXT_DECORATION -webkit-text-decoration-line +-webkit-text-decoration-style +#endif -webkit-text-decorations-in-effect -webkit-text-emphasis -epub-text-emphasis = -webkit-text-emphasis diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp index 13479b640..eabee493a 100644 --- a/Source/WebCore/css/CSSSelector.cpp +++ b/Source/WebCore/css/CSSSelector.cpp @@ -217,79 +217,79 @@ PseudoId CSSSelector::pseudoId(PseudoType type) static HashMap* nameToPseudoTypeMap() { - DEFINE_STATIC_LOCAL(AtomicString, active, ("active")); - DEFINE_STATIC_LOCAL(AtomicString, after, ("after")); - DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any(")); - DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link")); - DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill")); - DEFINE_STATIC_LOCAL(AtomicString, before, ("before")); - DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); - DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); - DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); - DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only")); - DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write")); - DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid")); - DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid")); - DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag")); - DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag")); // was documented with this name in Apple documentation, so keep an alia - DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty")); - DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled")); - DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child")); - DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter")); - DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line")); - DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type")); - DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media")); - DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child(")); - DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type(")); - DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child(")); - DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type(")); - DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus")); - DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover")); - DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate")); - DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child")); - DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type")); - DEFINE_STATIC_LOCAL(AtomicString, link, ("link")); - DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang(")); - DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not(")); - DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child")); - DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); - DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); - DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); - DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); - DEFINE_STATIC_LOCAL(AtomicString, root, ("root")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-button")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corner")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track")); - DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece")); - DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection")); - DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope")); - DEFINE_STATIC_LOCAL(AtomicString, target, ("target")); - DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited")); - DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive")); - DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement")); - DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment")); - DEFINE_STATIC_LOCAL(AtomicString, start, ("start")); - DEFINE_STATIC_LOCAL(AtomicString, end, ("end")); - DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal")); - DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical")); - DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button")); - DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button")); - DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button")); - DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present")); + DEFINE_STATIC_LOCAL(AtomicString, active, ("active", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, after, ("after", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, before, ("before", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag", AtomicString::ConstructFromLiteral)); // was documented with this name in Apple documentation, so keep an alia + DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, link, ("link", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not(", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, required, ("required", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, root, ("root", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-button", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corner", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, target, ("target", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, start, ("start", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, end, ("end", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present", AtomicString::ConstructFromLiteral)); // Paged Media pseudo-classes - DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first")); - DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left")); - DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right")); + DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right", AtomicString::ConstructFromLiteral)); #if ENABLE(FULLSCREEN_API) - DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen")); - DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document")); - DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen-ancestor")); - DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition")); + DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen-ancestor", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition", AtomicString::ConstructFromLiteral)); #endif - DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range")); - DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range")); + DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range", AtomicString::ConstructFromLiteral)); + DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range", AtomicString::ConstructFromLiteral)); static HashMap* nameToPseudoType = 0; if (!nameToPseudoType) { diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp index 523a895f5..f16f8bbb3 100644 --- a/Source/WebCore/css/CSSStyleSheet.cpp +++ b/Source/WebCore/css/CSSStyleSheet.cpp @@ -85,18 +85,19 @@ PassRefPtr CSSStyleSheet::create(PassRefPtr s PassRefPtr CSSStyleSheet::create(PassRefPtr sheet, Node* ownerNode) { - return adoptRef(new CSSStyleSheet(sheet, ownerNode)); + return adoptRef(new CSSStyleSheet(sheet, ownerNode, false)); } PassRefPtr CSSStyleSheet::createInline(Node* ownerNode, const KURL& baseURL, const String& encoding) { CSSParserContext parserContext(ownerNode->document(), baseURL, encoding); - RefPtr sheet = StyleSheetContents::create(baseURL.string(), baseURL, parserContext); - return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode)); + RefPtr sheet = StyleSheetContents::create(baseURL.string(), parserContext); + return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true)); } CSSStyleSheet::CSSStyleSheet(PassRefPtr contents, CSSImportRule* ownerRule) : m_contents(contents) + , m_isInlineStylesheet(false) , m_isDisabled(false) , m_ownerNode(0) , m_ownerRule(ownerRule) @@ -104,8 +105,9 @@ CSSStyleSheet::CSSStyleSheet(PassRefPtr contents, CSSImportR m_contents->registerClient(this); } -CSSStyleSheet::CSSStyleSheet(PassRefPtr contents, Node* ownerNode) +CSSStyleSheet::CSSStyleSheet(PassRefPtr contents, Node* ownerNode, bool isInlineStylesheet) : m_contents(contents) + , m_isInlineStylesheet(isInlineStylesheet) , m_isDisabled(false) , m_ownerNode(ownerNode) , m_ownerRule(0) @@ -227,11 +229,24 @@ CSSRule* CSSStyleSheet::item(unsigned index) return cssRule.get(); } -PassRefPtr CSSStyleSheet::rules() +bool CSSStyleSheet::canAccessRules() const { - KURL url = m_contents->finalURL(); + if (m_isInlineStylesheet) + return true; + KURL baseURL = m_contents->baseURL(); + if (baseURL.isEmpty()) + return true; Document* document = ownerDocument(); - if (!url.isEmpty() && document && !document->securityOrigin()->canRequest(url)) + if (!document) + return true; + if (document->securityOrigin()->canRequest(baseURL)) + return true; + return false; +} + +PassRefPtr CSSStyleSheet::rules() +{ + if (!canAccessRules()) return 0; // IE behavior. RefPtr nonCharsetRules = StaticCSSRuleList::create(); @@ -310,9 +325,7 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio PassRefPtr CSSStyleSheet::cssRules() { - KURL url = m_contents->finalURL(); - Document* document = ownerDocument(); - if (!url.isEmpty() && document && !document->securityOrigin()->canRequest(url)) + if (!canAccessRules()) return 0; if (!m_ruleListCSSOMWrapper) m_ruleListCSSOMWrapper = adoptPtr(new StyleSheetCSSRuleList(this)); diff --git a/Source/WebCore/css/CSSStyleSheet.h b/Source/WebCore/css/CSSStyleSheet.h index f38472dca..44915140c 100644 --- a/Source/WebCore/css/CSSStyleSheet.h +++ b/Source/WebCore/css/CSSStyleSheet.h @@ -110,12 +110,15 @@ public: private: CSSStyleSheet(PassRefPtr, CSSImportRule* ownerRule); - CSSStyleSheet(PassRefPtr, Node* ownerNode); + CSSStyleSheet(PassRefPtr, Node* ownerNode, bool isInlineStylesheet); virtual bool isCSSStyleSheet() const { return true; } virtual String type() const { return "text/css"; } + + bool canAccessRules() const; RefPtr m_contents; + bool m_isInlineStylesheet; bool m_isDisabled; String m_title; RefPtr m_mediaQueries; diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 4af25f80c..853c77fc9 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -422,6 +422,7 @@ hide higher invert -webkit-isolate +-webkit-isolate-override -webkit-plaintext landscape ledger @@ -452,6 +453,9 @@ static thick thin underline +#if defined(ENABLE_CSS3_TEXT_DECORATION) && ENABLE_CSS3_TEXT_DECORATION +wavy +#endif -webkit-nowrap // CSS3 Values @@ -926,7 +930,7 @@ edges coarse fine -#if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS +#if (defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS) || (defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING) // -webkit-filter #if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS // values for the custom() function diff --git a/Source/WebCore/css/CSSValueList.cpp b/Source/WebCore/css/CSSValueList.cpp index 0b7ac7380..b120fa242 100644 --- a/Source/WebCore/css/CSSValueList.cpp +++ b/Source/WebCore/css/CSSValueList.cpp @@ -41,27 +41,17 @@ CSSValueList::CSSValueList(ValueListSeparator listSeparator) m_valueListSeparator = listSeparator; } -CSSValueList::CSSValueList(CSSParserValueList* list) +CSSValueList::CSSValueList(CSSParserValueList* parserValues) : CSSValue(ValueListClass) { m_valueListSeparator = SpaceSeparator; - if (list) { - size_t size = list->size(); - for (unsigned i = 0; i < size; ++i) - append(list->valueAt(i)->createCSSValue()); + if (parserValues) { + m_values.reserveInitialCapacity(parserValues->size()); + for (unsigned i = 0; i < parserValues->size(); ++i) + m_values.uncheckedAppend(parserValues->valueAt(i)->createCSSValue()); } } -void CSSValueList::append(PassRefPtr val) -{ - m_values.append(val); -} - -void CSSValueList::prepend(PassRefPtr val) -{ - m_values.prepend(val); -} - bool CSSValueList::removeAll(CSSValue* val) { bool found = false; diff --git a/Source/WebCore/css/CSSValueList.h b/Source/WebCore/css/CSSValueList.h index e988d6c2e..e6a9ebdc3 100644 --- a/Source/WebCore/css/CSSValueList.h +++ b/Source/WebCore/css/CSSValueList.h @@ -52,8 +52,8 @@ public: CSSValue* item(size_t index) { return index < m_values.size() ? m_values[index].get() : 0; } CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); } - void append(PassRefPtr); - void prepend(PassRefPtr); + void append(PassRefPtr value) { m_values.append(value); } + void prepend(PassRefPtr value) { m_values.prepend(value); } bool removeAll(CSSValue*); bool hasValue(CSSValue*) const; PassRefPtr copy(); diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp index 0c555804e..dee9ad345 100644 --- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp +++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp @@ -127,7 +127,7 @@ void PropertySetCSSStyleDeclaration::ref() } void PropertySetCSSStyleDeclaration::deref() -{ +{ m_propertySet->deref(); } @@ -148,7 +148,7 @@ String PropertySetCSSStyleDeclaration::item(unsigned i) const { if (i >= m_propertySet->propertyCount()) return ""; - return getPropertyName(m_propertySet->propertyAt(i).id()); + return m_propertySet->propertyAt(i).cssName(); } String PropertySetCSSStyleDeclaration::cssText() const @@ -206,7 +206,7 @@ String PropertySetCSSStyleDeclaration::getPropertyShorthand(const String& proper CSSPropertyID shorthandID = m_propertySet->getPropertyShorthand(propertyID); if (!shorthandID) return String(); - return getPropertyName(shorthandID); + return getPropertyNameString(shorthandID); } bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyName) diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index 25c134990..486a4dbb8 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -45,7 +45,6 @@ #include #if ENABLE(CSS_EXCLUSIONS) -#include "CSSWrapShapes.h" #include "WrapShapeFunctions.h" #include "WrapShapes.h" #endif @@ -720,7 +719,7 @@ public: bool parentIsAbsoluteSize = false; float size = 0; - if (styleResolver->hasParentNode()) { + if (styleResolver->parentStyle()) { parentSize = styleResolver->parentStyle()->fontDescription().specifiedSize(); parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription().isAbsoluteSize(); } @@ -1171,36 +1170,6 @@ public: } }; -class ApplyPropertyUnicodeBidi { -public: - static void applyValue(StyleResolver* styleResolver, CSSValue* value) - { - if (value->isValueList()) { - EUnicodeBidi rendererUnicodeBidi = RenderStyle::initialUnicodeBidi(); - for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { - CSSValue* item = i.value(); - ASSERT(item->isPrimitiveValue()); - EUnicodeBidi currentValue = *static_cast(item); - ASSERT(currentValue == Override || currentValue == Isolate); - if (currentValue != rendererUnicodeBidi && rendererUnicodeBidi != RenderStyle::initialUnicodeBidi()) - rendererUnicodeBidi = OverrideIsolate; - else - rendererUnicodeBidi = currentValue; - } - styleResolver->style()->setUnicodeBidi(rendererUnicodeBidi); - } - if (!value->isPrimitiveValue()) - return; - CSSPrimitiveValue* primitiveValue = static_cast(value); - styleResolver->style()->setUnicodeBidi(*primitiveValue); - } - static PropertyHandler createHandler() - { - PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); - return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); - } -}; - class ApplyPropertyLineHeight { public: static void applyValue(StyleResolver* styleResolver, CSSValue* value) @@ -1212,7 +1181,7 @@ public: Length lineHeight; if (primitiveValue->getIdent() == CSSValueNormal) - lineHeight = Length(-100.0, Percent); + lineHeight = RenderStyle::initialLineHeight(); else if (primitiveValue->isLength()) { double multiplier = styleResolver->style()->effectiveZoom(); if (styleResolver->style()->textSizeAdjust()) { @@ -1234,7 +1203,7 @@ public: } static PropertyHandler createHandler() { - PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); + PropertyHandler handler = ApplyPropertyDefaultBase::createHandler(); return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); } }; @@ -1933,13 +1902,16 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler()); setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler()); +#if ENABLE(CSS3_TEXT_DECORATION) setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler()); + setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault::createHandler()); +#endif // CSS3_TEXT_DECORATION setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler()); setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont::createHandler()); setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); - setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyUnicodeBidi::createHandler()); + setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler()); setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation::createHandler()); @@ -2092,6 +2064,9 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto::createHandler()); setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler()); +#if ENABLE(CSS_COMPOSITING) + setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault::createHandler()); +#endif } diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp index a48728ae6..adc7fc85c 100644 --- a/Source/WebCore/css/StylePropertySet.cpp +++ b/Source/WebCore/css/StylePropertySet.cpp @@ -50,9 +50,14 @@ static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap() return propertySetCSSOMWrapperMapInstance; } +static size_t immutableStylePropertySetSize(unsigned count) +{ + return sizeof(StylePropertySet) - sizeof(void*) + sizeof(CSSProperty) * count; +} + PassRefPtr StylePropertySet::createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode) { - void* slot = WTF::fastMalloc(sizeof(StylePropertySet) - sizeof(void*) + sizeof(CSSProperty) * count); + void* slot = WTF::fastMalloc(immutableStylePropertySetSize(count)); return adoptRef(new (slot) StylePropertySet(properties, count, cssParserMode, /* makeMutable */ false)); } @@ -1091,11 +1096,11 @@ unsigned StylePropertySet::averageSizeInBytes() void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + size_t actualSize = m_isMutable ? sizeof(StylePropertySet) : immutableStylePropertySetSize(m_arraySize); + MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS, actualSize); if (m_isMutable) info.addVectorPtr(m_mutablePropertyVector); - else - info.addRawBuffer(m_properties, m_arraySize * sizeof(CSSProperty)); + unsigned count = propertyCount(); for (unsigned i = 0; i < count; ++i) info.addInstrumentedMember(propertyAt(i)); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index ff9213aa8..ea5950e54 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -1908,6 +1908,7 @@ void StyleResolver::keyframeStylesForAnimation(Element* e, const RenderStyle* el PassRefPtr StyleResolver::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle) { + ASSERT(m_parentStyle); if (!e) return 0; @@ -1915,9 +1916,7 @@ PassRefPtr StyleResolver::pseudoStyleForElement(PseudoId pseudo, El initForStyleResolve(e, parentStyle, pseudo); m_style = RenderStyle::create(); - - if (m_parentStyle) - m_style->inheritFrom(m_parentStyle); + m_style->inheritFrom(m_parentStyle); // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking // those rules. @@ -2068,8 +2067,19 @@ static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) || style->isFloating() || style->isOutOfFlowPositioned(); } +static bool isDisplayFlexibleBox(EDisplay display) +{ +#if ENABLE(CSS3_FLEXBOX) + return display == FLEX || display == INLINE_FLEX; +#else + return false; +#endif +} + void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { + ASSERT(parentStyle); + // Cache our original display. style->setOriginalDisplay(style->display()); @@ -2129,7 +2139,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely // clear how that should work. - if (style->display() == INLINE && style->styleType() == NOPSEUDO && parentStyle && style->writingMode() != parentStyle->writingMode()) + if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->writingMode() != parentStyle->writingMode()) style->setDisplay(INLINE_BLOCK); // After performing the display mutation, check table rows. We do not honor position:relative on @@ -2153,14 +2163,14 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX)) style->setWritingMode(TopToBottomWritingMode); - if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) { + if (isDisplayFlexibleBox(parentStyle->display())) { style->setFloating(NoFloat); style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); } } // Make sure our z-index value is only applied if the object is positioned. - if (style->position() == StaticPosition) + if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display())) style->setHasAutoZIndex(); // Auto z-index becomes 0 for the root element and transparent objects. This prevents @@ -3659,7 +3669,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) case CSSPropertyFont: if (isInherit) { FontDescription fontDescription = m_parentStyle->fontDescription(); - m_style->setLineHeight(m_parentStyle->lineHeight()); + m_style->setLineHeight(m_parentStyle->specifiedLineHeight()); m_lineHeightValue = 0; setFontDescription(fontDescription); } else if (isInitial) { @@ -4403,7 +4413,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) #endif case CSSPropertyWebkitRtlOrdering: case CSSPropertyWebkitTextCombine: +#if ENABLE(CSS3_TEXT_DECORATION) case CSSPropertyWebkitTextDecorationLine: + case CSSPropertyWebkitTextDecorationStyle: +#endif // CSS3_TEXT_DECORATION case CSSPropertyWebkitTextEmphasisColor: case CSSPropertyWebkitTextEmphasisPosition: case CSSPropertyWebkitTextEmphasisStyle: diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index 46f909ad2..4e9fe9148 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -141,7 +141,7 @@ public: void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&); - PassRefPtr pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0); + PassRefPtr pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle); PassRefPtr styleForPage(int pageIndex); diff --git a/Source/WebCore/css/StyleRuleImport.cpp b/Source/WebCore/css/StyleRuleImport.cpp index 70ee9c3df..24942521d 100644 --- a/Source/WebCore/css/StyleRuleImport.cpp +++ b/Source/WebCore/css/StyleRuleImport.cpp @@ -68,7 +68,7 @@ void StyleRuleImport::setCSSStyleSheet(const String& href, const KURL& baseURL, if (!baseURL.isNull()) context.baseURL = baseURL; - m_styleSheet = StyleSheetContents::create(this, href, baseURL, context); + m_styleSheet = StyleSheetContents::create(this, href, context); Document* document = m_parentStyleSheet ? m_parentStyleSheet->singleOwnerDocument() : 0; m_styleSheet->parseAuthorStyleSheet(cachedStyleSheet, document ? document->securityOrigin() : 0); @@ -98,21 +98,24 @@ void StyleRuleImport::requestStyleSheet() if (!cachedResourceLoader) return; - String absHref = m_strHref; - if (!m_parentStyleSheet->finalURL().isNull()) + KURL absURL; + if (!m_parentStyleSheet->baseURL().isNull()) // use parent styleheet's URL as the base URL - absHref = KURL(m_parentStyleSheet->finalURL(), m_strHref).string(); + absURL = KURL(m_parentStyleSheet->baseURL(), m_strHref); + else + absURL = document->completeURL(m_strHref); // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. StyleSheetContents* rootSheet = m_parentStyleSheet; for (StyleSheetContents* sheet = m_parentStyleSheet; sheet; sheet = sheet->parentStyleSheet()) { - if (absHref == sheet->finalURL().string() || absHref == sheet->originalURL()) + if (equalIgnoringFragmentIdentifier(absURL, sheet->baseURL()) + || equalIgnoringFragmentIdentifier(absURL, document->completeURL(sheet->originalURL()))) return; rootSheet = sheet; } - ResourceRequest request(document->completeURL(absHref)); + ResourceRequest request(absURL); if (m_parentStyleSheet->isUserStyleSheet()) m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, m_parentStyleSheet->charset()); else diff --git a/Source/WebCore/css/StyleSheetContents.cpp b/Source/WebCore/css/StyleSheetContents.cpp index 292debb94..96b4e54fa 100644 --- a/Source/WebCore/css/StyleSheetContents.cpp +++ b/Source/WebCore/css/StyleSheetContents.cpp @@ -54,10 +54,9 @@ unsigned StyleSheetContents::estimatedSizeInBytes() const return size; } -StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const KURL& finalURL, const CSSParserContext& context) +StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context) : m_ownerRule(ownerRule) , m_originalURL(originalURL) - , m_finalURL(finalURL) , m_loadCompleted(false) , m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet()) , m_hasSyntacticallyValidCSSHeader(true) @@ -73,7 +72,6 @@ StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) : RefCounted() , m_ownerRule(0) , m_originalURL(o.m_originalURL) - , m_finalURL(o.m_finalURL) , m_encodingFromCharsetRule(o.m_encodingFromCharsetRule) , m_importRules(o.m_importRules.size()) , m_childRules(o.m_childRules.size()) @@ -250,7 +248,10 @@ void StyleSheetContents::parserAddNamespace(const AtomicString& prefix, const At { if (uri.isNull() || prefix.isNull()) return; - m_namespaces.add(prefix, uri); + PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri); + if (result.isNewEntry) + return; + result.iterator->second = uri; } const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& prefix) @@ -280,7 +281,7 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached // to at least start with a syntactically valid CSS rule. // This prevents an attacker playing games by injecting CSS strings into HTML, XML, JSON, etc. etc. if (!hasValidMIMEType && !hasSyntacticallyValidCSSHeader()) { - bool isCrossOriginCSS = !securityOrigin || !securityOrigin->canRequest(finalURL()); + bool isCrossOriginCSS = !securityOrigin || !securityOrigin->canRequest(baseURL()); if (isCrossOriginCSS) { clearRules(); return; @@ -292,7 +293,7 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n")); // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKHTMLFixesStyleSheet, // while the other lacks the second trailing newline. - if (finalURL().string().endsWith(slashKHTMLFixesDotCss) && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText) + if (baseURL().string().endsWith(slashKHTMLFixesDotCss) && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText) && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1) clearRules(); } @@ -486,7 +487,6 @@ void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c { MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS); info.addMember(m_originalURL); - info.addMember(m_finalURL); info.addMember(m_encodingFromCharsetRule); info.addVector(m_importRules); info.addInstrumentedVector(m_childRules); diff --git a/Source/WebCore/css/StyleSheetContents.h b/Source/WebCore/css/StyleSheetContents.h index b1ddb8ccb..af0b294d5 100644 --- a/Source/WebCore/css/StyleSheetContents.h +++ b/Source/WebCore/css/StyleSheetContents.h @@ -44,15 +44,15 @@ class StyleSheetContents : public RefCounted { public: static PassRefPtr create(const CSSParserContext& context = CSSParserContext(CSSStrictMode)) { - return adoptRef(new StyleSheetContents(0, String(), KURL(), context)); + return adoptRef(new StyleSheetContents(0, String(), context)); } - static PassRefPtr create(const String& originalURL, const KURL& finalURL, const CSSParserContext& context) + static PassRefPtr create(const String& originalURL, const CSSParserContext& context) { - return adoptRef(new StyleSheetContents(0, originalURL, finalURL, context)); + return adoptRef(new StyleSheetContents(0, originalURL, context)); } - static PassRefPtr create(StyleRuleImport* ownerRule, const String& originalURL, const KURL& finalURL, const CSSParserContext& context) + static PassRefPtr create(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context) { - return adoptRef(new StyleSheetContents(ownerRule, originalURL, finalURL, context)); + return adoptRef(new StyleSheetContents(ownerRule, originalURL, context)); } ~StyleSheetContents(); @@ -112,8 +112,6 @@ public: // this style sheet. This property probably isn't useful for much except // the JavaScript binding (which needs to use this value for security). String originalURL() const { return m_originalURL; } - - const KURL& finalURL() const { return m_finalURL; } const KURL& baseURL() const { return m_parserContext.baseURL; } unsigned ruleCount() const; @@ -142,7 +140,7 @@ public: void reportMemoryUsage(MemoryObjectInfo*) const; private: - StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const KURL& baseURL, const CSSParserContext&); + StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext&); StyleSheetContents(const StyleSheetContents&); void clearCharsetRule(); @@ -150,7 +148,6 @@ private: StyleRuleImport* m_ownerRule; String m_originalURL; - KURL m_finalURL; String m_encodingFromCharsetRule; Vector > m_importRules; diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 43b65a139..d60ca0ed5 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -490,8 +490,7 @@ input::-webkit-datetime-edit { input::-webkit-datetime-edit-ampm-field { -webkit-user-modify: read-only !important; border: none; - width: 2em; - padding: 2px; + padding: 0.15em; } input::-webkit-datetime-edit-hour-field { @@ -499,8 +498,7 @@ input::-webkit-datetime-edit-hour-field { display: inline-block; border: none; text-align: center; - width: 1.2em; - padding: 2px; + padding: 0.15em; } input::-webkit-datetime-edit-millisecond-field { @@ -508,8 +506,7 @@ input::-webkit-datetime-edit-millisecond-field { display: inline-block; border: none; text-align: center; - width: 1.8em; - padding: 2px; + padding: 0.15em; } input::-webkit-datetime-edit-minute-field { @@ -517,8 +514,7 @@ input::-webkit-datetime-edit-minute-field { display: inline-block; border: none; text-align: center; - width: 1.2em; - padding: 2px; + padding: 0.15em; } /* This selector is used when step >= 3600 second but format contains minute field. */ @@ -531,14 +527,17 @@ input::-webkit-datetime-edit-second-field { display: inline-block; border: none; text-align: center; - width: 1.2em; - padding: 2px; + padding: 0.15em; } /* This selector is used when step >= 60 second but format contains second field. */ input::-webkit-datetime-edit-second-field[readonly] { color: GrayText; } + +input[type="time"]::-webkit-inner-spin-button { + margin-left: 0.2em; +} #endif input::-webkit-inner-spin-button { @@ -894,12 +893,20 @@ output { meter { -webkit-appearance: meter; -webkit-box-sizing: border-box; - display: inline-box; + display: inline-block; height: 1em; width: 5em; vertical-align: -0.2em; } +meter::-webkit-meter-inner-element { + -webkit-appearance: inherit; + -webkit-box-sizing: inherit; + -webkit-user-modify: read-only !important; + height: 100%; + width: 100%; +} + meter::-webkit-meter-bar { background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); height: 100%; diff --git a/Source/WebCore/css/makeprop.pl b/Source/WebCore/css/makeprop.pl index a5bfb0649..773435687 100644 --- a/Source/WebCore/css/makeprop.pl +++ b/Source/WebCore/css/makeprop.pl @@ -70,9 +70,19 @@ print GPERF << "EOF"; #include #include +#include #include namespace WebCore { +EOF + +print GPERF "const char* const propertyNameStrings[numCSSProperties] = {\n"; +foreach my $name (@names) { + print GPERF " \"$name\",\n"; +} +print GPERF "};\n\n"; + +print GPERF << "EOF"; %} %struct-type struct Property; @@ -120,7 +130,30 @@ const char* getPropertyName(CSSPropertyID id) return propertyNameStrings[index]; } -WTF::String getJSPropertyName(CSSPropertyID id) +const AtomicString& getPropertyNameAtomicString(CSSPropertyID id) +{ + if (id < firstCSSProperty) + return nullAtom; + int index = id - firstCSSProperty; + if (index >= numCSSProperties) + return nullAtom; + + static AtomicString* propertyStrings = new AtomicString[numCSSProperties]; // Intentionally never destroyed. + AtomicString& propertyString = propertyStrings[index]; + if (propertyString.isNull()) { + const char* propertyName = propertyNameStrings[index]; + propertyString = AtomicString(propertyName, strlen(propertyName), AtomicString::ConstructFromLiteral); + } + return propertyString; +} + +String getPropertyNameString(CSSPropertyID id) +{ + // We share the StringImpl with the AtomicStrings. + return getPropertyNameAtomicString(id).string(); +} + +String getJSPropertyName(CSSPropertyID id) { char result[maxCSSPropertyNameLength + 1]; const char* cssPropertyName = getPropertyName(id); @@ -157,6 +190,7 @@ print HEADER << "EOF"; #include namespace WTF { +class AtomicString; class String; } @@ -190,15 +224,11 @@ print HEADER "const int numCSSProperties = $num;\n"; print HEADER "const int lastCSSProperty = $last;\n"; print HEADER "const size_t maxCSSPropertyNameLength = $maxLen;\n"; -print HEADER "const char* const propertyNameStrings[$num] = {\n"; -foreach my $name (@names) { - print HEADER "\"$name\",\n"; -} -print HEADER "};\n"; - print HEADER << "EOF"; const char* getPropertyName(CSSPropertyID); +const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID id); +WTF::String getPropertyNameString(CSSPropertyID id); WTF::String getJSPropertyName(CSSPropertyID); inline CSSPropertyID convertToCSSPropertyID(int value) diff --git a/Source/WebCore/css/themeWin.css b/Source/WebCore/css/themeWin.css index 52be43eed..3dd1ccaad 100644 --- a/Source/WebCore/css/themeWin.css +++ b/Source/WebCore/css/themeWin.css @@ -43,7 +43,9 @@ input[type="number"], input[type="password"], input[type="tel"], input[type="text"], +#if !defined(ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS) || !ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS input[type="time"], +#endif input[type="url"], input[type="week"] { padding:1px 0; -- cgit v1.2.1