diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/css | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/css')
35 files changed, 1759 insertions, 410 deletions
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index a023fbd..4c0571d 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -29,6 +29,7 @@ #include "CounterContent.h" #include "CursorList.h" #include "CSSBorderImageValue.h" +#include "CSSLineBoxContainValue.h" #include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSPrimitiveValueCache.h" @@ -204,6 +205,7 @@ static const int computedProperties[] = { CSSPropertyWebkitHyphenateLimitAfter, CSSPropertyWebkitHyphenateLimitBefore, CSSPropertyWebkitHyphens, + CSSPropertyWebkitLineBoxContain, CSSPropertyWebkitLineBreak, CSSPropertyWebkitLineClamp, CSSPropertyWebkitLocale, @@ -232,6 +234,7 @@ static const int computedProperties[] = { CSSPropertyWebkitTextEmphasisPosition, CSSPropertyWebkitTextEmphasisStyle, CSSPropertyWebkitTextFillColor, + CSSPropertyWebkitTextOrientation, CSSPropertyWebkitTextSecurity, CSSPropertyWebkitTextStrokeColor, CSSPropertyWebkitTextStrokeWidth, @@ -586,6 +589,13 @@ static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList return list.release(); } +static PassRefPtr<CSSValue> createLineBoxContainValue(CSSPrimitiveValueCache* primitiveValueCache, unsigned lineBoxContain) +{ + if (!lineBoxContain) + return primitiveValueCache->createIdentifierValue(CSSValueNone); + return CSSLineBoxContainValue::create(lineBoxContain); +} + CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName) : m_node(n) , m_allowVisitedStyle(allowVisitedStyle) @@ -672,8 +682,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowDat RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style, primitiveValueCache); RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(s->y(), style, primitiveValueCache); RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style, primitiveValueCache); - RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : zoomAdjustedPixelValue(s->spread(), style, primitiveValueCache); - RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? 0 : primitiveValueCache->createIdentifierValue(CSSValueInset); + RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : zoomAdjustedPixelValue(s->spread(), style, primitiveValueCache); + RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : primitiveValueCache->createIdentifierValue(CSSValueInset); RefPtr<CSSPrimitiveValue> color = primitiveValueCache->createColorValue(s->color().rgb()); list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); } @@ -780,8 +790,11 @@ static PassRefPtr<CSSValue> contentToCSSValue(const RenderStyle* style, CSSPrimi static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, int propertyID, CSSPrimitiveValueCache* primitiveValueCache) { - RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); const CounterDirectiveMap* map = style->counterDirectives(); + if (!map) + return 0; + + RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) { list->append(primitiveValueCache->createValue(it->first.get(), CSSPrimitiveValue::CSS_STRING)); short number = propertyID == CSSPropertyCounterIncrement ? it->second.m_incrementValue : it->second.m_resetValue; @@ -1687,7 +1700,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return primitiveValueCache->createValue(style->writingMode()); case CSSPropertyWebkitTextCombine: return primitiveValueCache->createValue(style->textCombine()); - + case CSSPropertyWebkitTextOrientation: + return CSSPrimitiveValue::create(style->fontDescription().textOrientation()); + case CSSPropertyWebkitLineBoxContain: + return createLineBoxContainValue(primitiveValueCache, style->lineBoxContain()); case CSSPropertyContent: return contentToCSSValue(style.get(), primitiveValueCache); case CSSPropertyCounterIncrement: diff --git a/Source/WebCore/css/CSSFontFaceSource.cpp b/Source/WebCore/css/CSSFontFaceSource.cpp index 681a94b..d32684e 100644 --- a/Source/WebCore/css/CSSFontFaceSource.cpp +++ b/Source/WebCore/css/CSSFontFaceSource.cpp @@ -115,7 +115,8 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri } // See if we have a mapping in our FontData cache. - unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3 | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); + unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 6 | fontDescription.widthVariant() << 4 + | (fontDescription.textOrientation() == TextOrientationUpright ? 8 : 0) | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0); if (SimpleFontData* cachedData = m_fontDataTable.get(hashKey)) return cachedData; @@ -162,7 +163,8 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri if (!m_font->ensureCustomFontData()) return 0; - fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); + fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(), + fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false)); } } else { #if ENABLE(SVG_FONTS) diff --git a/Source/WebCore/css/CSSGrammar.y b/Source/WebCore/css/CSSGrammar.y index 8658674..246a449 100644 --- a/Source/WebCore/css/CSSGrammar.y +++ b/Source/WebCore/css/CSSGrammar.y @@ -99,7 +99,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %} -%expect 51 +%expect 55 %nonassoc LOWEST_PREC @@ -183,13 +183,18 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %token <number> HERTZ %token <number> KHERTZ %token <string> DIMEN +%token <string> INVALIDDIMEN %token <number> PERCENTAGE %token <number> FLOATTOKEN %token <number> INTEGER %token <string> URI %token <string> FUNCTION +%token <string> ANYFUNCTION %token <string> NOTFUNCTION +%token <string> CALCFUNCTION +%token <string> MINFUNCTION +%token <string> MAXFUNCTION %token <string> UNICODERANGE @@ -247,6 +252,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <selector> simple_selector %type <selector> selector %type <selectorList> selector_list +%type <selectorList> simple_selector_list %type <selector> selector_with_trailing_whitespace %type <selector> class %type <selector> attrib @@ -270,6 +276,14 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <value> term %type <value> unary_term %type <value> function +%type <value> calc_func_term +%type <character> calc_func_operator +%type <valueList> calc_func_expr +%type <valueList> calc_func_expr_list +%type <valueList> calc_func_paren_expr +%type <value> calc_function +%type <string> min_or_max +%type <value> min_or_max_function %type <string> element_name %type <string> attr_name @@ -921,6 +935,28 @@ simple_selector: } ; +simple_selector_list: + simple_selector %prec UNIMPORTANT_TOK { + if ($1) { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelectorVector(); + $$->append(p->sinkFloatingSelector($1)); + } else + $$ = 0 + } + | simple_selector_list maybe_space ',' maybe_space simple_selector %prec UNIMPORTANT_TOK { + if ($1 && $5) { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = $1; + $$->append(p->sinkFloatingSelector($5)); + } else + $$ = 0; + } + | simple_selector_list error { + $$ = 0; + } + ; + element_name: IDENT { CSSParserString& str = $1; @@ -1102,6 +1138,25 @@ pseudo: // FIXME: This call is needed to force selector to compute the pseudoType early enough. $$->pseudoType(); } + // use by :-webkit-any. + // FIXME: should we support generic selectors here or just simple_selectors? + // Use simple_selector_list for now to match -moz-any. + // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0566.html for some + // related discussion with respect to :not. + | ':' ANYFUNCTION maybe_space simple_selector_list maybe_space ')' { + if ($4) { + CSSParser *p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelector(); + $$->setMatch(CSSSelector::PseudoClass); + $$->adoptSelectorVector(*p->sinkFloatingSelectorVector($4)); + $2.lower(); + $$->setValue($2); + CSSSelector::PseudoType type = $$->pseudoType(); + if (type != CSSSelector::PseudoAny) + $$ = 0; + } else + $$ = 0; + } // used by :nth-*(ax+b) | ':' FUNCTION maybe_space NTH maybe_space ')' { CSSParser *p = static_cast<CSSParser*>(parser); @@ -1151,7 +1206,11 @@ pseudo: CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); $$->setMatch(CSSSelector::PseudoClass); - $$->setSimpleSelector(p->sinkFloatingSelector($4)->releaseSelector()); + + Vector<OwnPtr<CSSParserSelector> > selectorVector; + selectorVector.append(p->sinkFloatingSelector($4)); + $$->adoptSelectorVector(selectorVector); + $2.lower(); $$->setValue($2); } @@ -1361,6 +1420,12 @@ term: | function { $$ = $1; } + | calc_function { + $$ = $1; + } + | min_or_max_function { + $$ = $1; + } | '%' maybe_space { /* Handle width: %; */ $$.id = 0; $$.unit = 0; } @@ -1417,6 +1482,143 @@ function: $$.function = f; } ; + +calc_func_term: + unary_term { $$ = $1; } + | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } + ; + +calc_func_operator: + '+' WHITESPACE { + $$ = '+'; + } + | '-' WHITESPACE { + $$ = '-'; + } + | '*' maybe_space { + $$ = '*'; + } + | '/' maybe_space { + $$ = '/'; + } + | IDENT maybe_space { + if (equalIgnoringCase("mod", $1.characters, $1.length)) + $$ = '%'; + else + $$ = 0; + } + ; + +calc_func_paren_expr: + '(' maybe_space calc_func_expr maybe_space ')' maybe_space { + if ($3) { + $$ = $3; + CSSParserValue v; + v.id = 0; + v.unit = CSSParserValue::Operator; + v.iValue = '('; + $$->insertValueAt(0, v); + v.iValue = ')'; + $$->addValue(v); + } + } + +calc_func_expr: + calc_func_term maybe_space { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingValueList(); + $$->addValue(p->sinkFloatingValue($1)); + } + | calc_func_expr calc_func_operator calc_func_term { + CSSParser* p = static_cast<CSSParser*>(parser); + if ($1 && $2) { + $$ = $1; + CSSParserValue v; + v.id = 0; + v.unit = CSSParserValue::Operator; + v.iValue = $2; + $$->addValue(v); + $$->addValue(p->sinkFloatingValue($3)); + } else + $$ = 0; + + } + | calc_func_expr calc_func_operator calc_func_paren_expr { + if ($1 && $2 && $3) { + $$ = $1; + CSSParserValue v; + v.id = 0; + v.unit = CSSParserValue::Operator; + v.iValue = $2; + $$->addValue(v); + $$->extend(*($3)); + } else + $$ = 0; + } + | calc_func_paren_expr + | calc_func_expr error { + $$ = 0; + } + ; + +calc_func_expr_list: + calc_func_expr { + $$ = $1; + } + | calc_func_expr_list ',' maybe_space calc_func_expr { + if ($1 && $4) { + $$ = $1; + CSSParserValue v; + v.id = 0; + v.unit = CSSParserValue::Operator; + v.iValue = ','; + $$->addValue(v); + $$->extend(*($4)); + } else + $$ = 0; + } + + +calc_function: + CALCFUNCTION maybe_space calc_func_expr ')' maybe_space { + CSSParser* p = static_cast<CSSParser*>(parser); + CSSParserFunction* f = p->createFloatingFunction(); + f->name = $1; + f->args = p->sinkFloatingValueList($3); + $$.id = 0; + $$.unit = CSSParserValue::Function; + $$.function = f; + } + | CALCFUNCTION maybe_space error { + YYERROR; + } + ; + + +min_or_max: + MINFUNCTION { + $$ = $1; + } + | MAXFUNCTION { + $$ = $1; + } + ; + +min_or_max_function: + min_or_max maybe_space calc_func_expr_list ')' maybe_space { + CSSParser* p = static_cast<CSSParser*>(parser); + CSSParserFunction* f = p->createFloatingFunction(); + f->name = $1; + f->args = p->sinkFloatingValueList($3); + $$.id = 0; + $$.unit = CSSParserValue::Function; + $$.function = f; + } + | min_or_max maybe_space error { + YYERROR; + } + ; + /* * There is a constraint on the color that it must * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) diff --git a/Source/WebCore/css/CSSImageValue.cpp b/Source/WebCore/css/CSSImageValue.cpp index 6896596..a9038b9 100644 --- a/Source/WebCore/css/CSSImageValue.cpp +++ b/Source/WebCore/css/CSSImageValue.cpp @@ -67,10 +67,6 @@ StyleCachedImage* CSSImageValue::cachedImage(CachedResourceLoader* loader) StyleCachedImage* CSSImageValue::cachedImage(CachedResourceLoader* loader, const String& url) { ASSERT(loader); - if (!loader) { - // FIXME: Remove when http://webkit.org/b/53045 is fixed. - CRASH(); - } if (!m_accessedImage) { m_accessedImage = true; diff --git a/Source/WebCore/css/CSSLineBoxContainValue.cpp b/Source/WebCore/css/CSSLineBoxContainValue.cpp new file mode 100644 index 0000000..b029285 --- /dev/null +++ b/Source/WebCore/css/CSSLineBoxContainValue.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CSSLineBoxContainValue.h" + +#include "CSSPrimitiveValue.h" +#include "PlatformString.h" + +namespace WebCore { + +CSSLineBoxContainValue::CSSLineBoxContainValue(unsigned value) + : m_value(value) +{ +} + +String CSSLineBoxContainValue::cssText() const +{ + String text(""); + + if (m_value & LineBoxContainBlock) + text += "block"; + if (m_value & LineBoxContainInline) { + if (!text.isEmpty()) + text += " "; + text += "inline"; + } + if (m_value & LineBoxContainFont) { + if (!text.isEmpty()) + text += " "; + text += "font"; + } + if (m_value & LineBoxContainGlyphs) { + if (!text.isEmpty()) + text += " "; + text += "glyphs"; + } + if (m_value & LineBoxContainReplaced) { + if (!text.isEmpty()) + text += " "; + text += "replaced"; + } + if (m_value & LineBoxContainInlineBox) { + if (!text.isEmpty()) + text += " "; + text += "inline-box"; + } + + return text; +} + +} diff --git a/Source/WebCore/css/CSSLineBoxContainValue.h b/Source/WebCore/css/CSSLineBoxContainValue.h new file mode 100644 index 0000000..8d62b11 --- /dev/null +++ b/Source/WebCore/css/CSSLineBoxContainValue.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CSSLineBoxContainValue_h +#define CSSLineBoxContainValue_h + +#include "CSSValue.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class CSSPrimitiveValue; + +enum LineBoxContainFlags { LineBoxContainNone = 0x0, LineBoxContainBlock = 0x1, LineBoxContainInline = 0x2, LineBoxContainFont = 0x4, LineBoxContainGlyphs = 0x8, + LineBoxContainReplaced = 0x10, LineBoxContainInlineBox = 0x20 }; +typedef unsigned LineBoxContain; + +// Used for text-CSSLineBoxContain and box-CSSLineBoxContain +class CSSLineBoxContainValue : public CSSValue { +public: + static PassRefPtr<CSSLineBoxContainValue> create(LineBoxContain value) + { + return adoptRef(new CSSLineBoxContainValue(value)); + } + + virtual String cssText() const; + + LineBoxContain value() const { return m_value; } + +private: + LineBoxContain m_value; + +private: + CSSLineBoxContainValue(LineBoxContain); + virtual bool isCSSLineBoxContainValue() const { return true; } +}; + +} // namespace + +#endif diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp index e6a49d3..6485e5b 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -82,15 +82,18 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS #endif { m_properties.reserveInitialCapacity(numProperties); - HashSet<int> candidates; + HashMap<int, bool> candidates; for (int i = 0; i < numProperties; ++i) { const CSSProperty *property = properties[i]; ASSERT(property); - if (candidates.contains(property->id())) - removeProperty(properties[i]->id(), false); + bool important = property->isImportant(); + if (candidates.contains(property->id())) { + if (!important && candidates.get(property->id())) + continue; + removeProperty(property->id(), false); + } m_properties.append(*property); - if (!getPropertyPriority(property->id()) && !property->isImportant()) - candidates.add(property->id()); + candidates.set(property->id(), important); } } @@ -129,11 +132,11 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const case CSSPropertyBackgroundPosition: { // FIXME: Is this correct? The code in cssparser.cpp is confusing const int properties[2] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY }; - return getLayeredShorthandValue(properties, 2); + return getLayeredShorthandValue(properties); } case CSSPropertyBackgroundRepeat: { const int properties[2] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; - return getLayeredShorthandValue(properties, 2); + return getLayeredShorthandValue(properties); } case CSSPropertyBackground: { const int properties[9] = { CSSPropertyBackgroundColor, @@ -145,7 +148,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const CSSPropertyBackgroundPositionY, CSSPropertyBackgroundClip, CSSPropertyBackgroundOrigin }; - return getLayeredShorthandValue(properties, 9); + return getLayeredShorthandValue(properties); } case CSSPropertyBorder: { const int properties[3][4] = {{ CSSPropertyBorderTopWidth, @@ -162,7 +165,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const CSSPropertyBorderLeftColor }}; String res; for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { - String value = getCommonValue(properties[i], 4); + String value = getCommonValue(properties[i]); if (!value.isNull()) { if (!res.isNull()) res += " "; @@ -174,27 +177,27 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const case CSSPropertyBorderTop: { const int properties[3] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderTopColor}; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyBorderRight: { const int properties[3] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, CSSPropertyBorderRightColor}; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyBorderBottom: { const int properties[3] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomColor}; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyBorderLeft: { const int properties[3] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftColor}; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyOutline: { const int properties[3] = { CSSPropertyOutlineWidth, CSSPropertyOutlineStyle, CSSPropertyOutlineColor }; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyBorderColor: { const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, @@ -218,7 +221,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const } case CSSPropertyOverflow: { const int properties[2] = { CSSPropertyOverflowX, CSSPropertyOverflowY }; - return getCommonValue(properties, 2); + return getCommonValue(properties); } case CSSPropertyPadding: { const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, @@ -228,40 +231,40 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const case CSSPropertyListStyle: { const int properties[3] = { CSSPropertyListStyleType, CSSPropertyListStylePosition, CSSPropertyListStyleImage }; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyWebkitMaskPosition: { // FIXME: Is this correct? The code in cssparser.cpp is confusing const int properties[2] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY }; - return getLayeredShorthandValue(properties, 2); + return getLayeredShorthandValue(properties); } case CSSPropertyWebkitMaskRepeat: { const int properties[2] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY }; - return getLayeredShorthandValue(properties, 2); + return getLayeredShorthandValue(properties); } case CSSPropertyWebkitMask: { const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat, CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskClip, CSSPropertyWebkitMaskOrigin }; - return getLayeredShorthandValue(properties, 6); + return getLayeredShorthandValue(properties); } case CSSPropertyWebkitTransformOrigin: { const int properties[3] = { CSSPropertyWebkitTransformOriginX, CSSPropertyWebkitTransformOriginY, CSSPropertyWebkitTransformOriginZ }; - return getShorthandValue(properties, 3); + return getShorthandValue(properties); } case CSSPropertyWebkitTransition: { const int properties[4] = { CSSPropertyWebkitTransitionProperty, CSSPropertyWebkitTransitionDuration, CSSPropertyWebkitTransitionTimingFunction, CSSPropertyWebkitTransitionDelay }; - return getLayeredShorthandValue(properties, 4); + return getLayeredShorthandValue(properties); } case CSSPropertyWebkitAnimation: { const int properties[7] = { CSSPropertyWebkitAnimationName, CSSPropertyWebkitAnimationDuration, CSSPropertyWebkitAnimationTimingFunction, CSSPropertyWebkitAnimationDelay, CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection, CSSPropertyWebkitAnimationFillMode }; - return getLayeredShorthandValue(properties, 7); + return getLayeredShorthandValue(properties); } #if ENABLE(SVG) case CSSPropertyMarker: { @@ -331,15 +334,15 @@ String CSSMutableStyleDeclaration::get4Values(const int* properties) const return res; } -String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* properties, unsigned number) const +String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* properties, size_t size) const { String res; // Begin by collecting the properties into an array. - Vector< RefPtr<CSSValue> > values(number); + Vector< RefPtr<CSSValue> > values(size); size_t numLayers = 0; - for (size_t i = 0; i < number; ++i) { + for (size_t i = 0; i < size; ++i) { values[i] = getPropertyCSSValue(properties[i]); if (values[i]) { if (values[i]->isValueList()) { @@ -357,7 +360,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie bool useRepeatXShorthand = false; bool useRepeatYShorthand = false; bool useSingleWordShorthand = false; - for (size_t j = 0; j < number; j++) { + for (size_t j = 0; j < size; j++) { RefPtr<CSSValue> value; if (values[j]) { if (values[j]->isValueList()) @@ -380,7 +383,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie if (properties[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(properties[j])) { // BUG 49055: make sure the value was not reset in the layer check just above. - if (j < number - 1 && properties[j + 1] == CSSPropertyBackgroundRepeatY && value) { + if (j < size - 1 && properties[j + 1] == CSSPropertyBackgroundRepeatY && value) { RefPtr<CSSValue> yValue; RefPtr<CSSValue> nextValue = values[j + 1]; if (nextValue->isValueList()) @@ -432,10 +435,10 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie return res; } -String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, int number) const +String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size_t size) const { String res; - for (int i = 0; i < number; ++i) { + for (size_t i = 0; i < size; ++i) { if (!isPropertyImplicit(properties[i])) { RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); // FIXME: provide default value if !value @@ -450,10 +453,10 @@ String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, int } // only returns a non-null value if all properties have the same, non-null value -String CSSMutableStyleDeclaration::getCommonValue(const int* properties, int number) const +String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t size) const { String res; - for (int i = 0; i < number; ++i) { + for (size_t i = 0; i < size; ++i) { RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); if (!value) return String(); @@ -509,14 +512,18 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha return value; } +bool CSSMutableStyleDeclaration::isInlineStyleDeclaration() +{ + // FIXME: Ideally, this should be factored better and there + // should be a subclass of CSSMutableStyleDeclaration just + // for inline style declarations that handles this + return m_node && m_node->isStyledElement() && static_cast<StyledElement*>(m_node)->inlineStyleDecl() == this; +} + void CSSMutableStyleDeclaration::setNeedsStyleRecalc() { if (m_node) { - // FIXME: Ideally, this should be factored better and there - // should be a subclass of CSSMutableStyleDeclaration just - // for inline style declarations that handles this - bool isInlineStyleDeclaration = m_node->isStyledElement() && this == static_cast<StyledElement*>(m_node)->inlineStyleDecl(); - if (isInlineStyleDeclaration) { + if (isInlineStyleDeclaration()) { m_node->setNeedsStyleRecalc(InlineStyleChange); static_cast<StyledElement*>(m_node)->invalidateStyleAttribute(); if (m_node->document()) @@ -717,7 +724,7 @@ String CSSMutableStyleDeclaration::cssText() const String positionValue; const int properties[2] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY }; if (positionXProp->value()->isValueList() || positionYProp->value()->isValueList()) - positionValue = getLayeredShorthandValue(properties, 2); + positionValue = getLayeredShorthandValue(properties); else positionValue = positionXProp->value()->cssText() + " " + positionYProp->value()->cssText(); result += "background-position: " + positionValue + (positionXProp->isImportant() ? " !important" : "") + "; "; @@ -733,7 +740,7 @@ String CSSMutableStyleDeclaration::cssText() const String repeatValue; const int repeatProperties[2] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; if (repeatXProp->value()->isValueList() || repeatYProp->value()->isValueList()) - repeatValue = getLayeredShorthandValue(repeatProperties, 2); + repeatValue = getLayeredShorthandValue(repeatProperties); else repeatValue = repeatXProp->value()->cssText() + " " + repeatYProp->value()->cssText(); result += "background-repeat: " + repeatValue + (repeatXProp->isImportant() ? " !important" : "") + "; "; diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/CSSMutableStyleDeclaration.h index 0eab1b6..ca17f11 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.h +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.h @@ -140,6 +140,8 @@ public: bool propertiesEqual(const CSSMutableStyleDeclaration* o) const { return m_properties == o->m_properties; } + bool isInlineStyleDeclaration(); + protected: CSSMutableStyleDeclaration(CSSRule* parentRule); @@ -152,12 +154,16 @@ private: void setNeedsStyleRecalc(); - String getShorthandValue(const int* properties, int number) const; - String getCommonValue(const int* properties, int number) const; - String getLayeredShorthandValue(const int* properties, unsigned number) const; + String getShorthandValue(const int* properties, size_t) const; + String getCommonValue(const int* properties, size_t) const; + String getLayeredShorthandValue(const int* properties, size_t) const; String get4Values(const int* properties) const; String borderSpacingValue(const int properties[2]) const; - + + template<size_t size> String getShorthandValue(const int (&properties)[size]) const { return getShorthandValue(properties, size); } + template<size_t size> String getCommonValue(const int (&properties)[size]) const { return getCommonValue(properties, size); } + template<size_t size> String getLayeredShorthandValue(const int (&properties)[size]) const { return getLayeredShorthandValue(properties, size); } + void setPropertyInternal(const CSSProperty&, CSSProperty* slot = 0); bool removeShorthandProperty(int propertyID, bool notifyChanged); diff --git a/Source/WebCore/css/CSSOMUtils.cpp b/Source/WebCore/css/CSSOMUtils.cpp index d1e9638..7ecd938 100644 --- a/Source/WebCore/css/CSSOMUtils.cpp +++ b/Source/WebCore/css/CSSOMUtils.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "CSSOMUtils.h" -#include "PlatformString.h" +#include <wtf/HexNumber.h> namespace WebCore { @@ -53,7 +53,9 @@ void serializeCharacter(UChar32 c, Vector<UChar>& appendTo) void serializeCharacterAsCodePoint(UChar32 c, Vector<UChar>& appendTo) { - append(appendTo, String::format("\\%x ", c)); + appendTo.append('\\'); + appendUnsignedAsHex(c, appendTo, Lowercase); + appendTo.append(' '); } void serializeIdentifier(const String& identifier, String& appendTo) diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index df8816c..02733ae 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -36,6 +36,7 @@ #include "CSSImportRule.h" #include "CSSInheritedValue.h" #include "CSSInitialValue.h" +#include "CSSLineBoxContainValue.h" #include "CSSMediaRule.h" #include "CSSMutableStyleDeclaration.h" #include "CSSPageRule.h" @@ -72,6 +73,7 @@ #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSTransformValue.h" #include <limits.h> +#include <wtf/HexNumber.h> #include <wtf/dtoa.h> #include <wtf/text/StringBuffer.h> @@ -97,6 +99,7 @@ using namespace WTF; namespace WebCore { static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; +static const double MAX_SCALE = 1000000; static bool equal(const CSSParserString& a, const char* b) { @@ -177,6 +180,7 @@ CSSParser::~CSSParser() fastFree(m_data); fastDeleteAllValues(m_floatingSelectors); + deleteAllValues(m_floatingSelectorVectors); deleteAllValues(m_floatingValueLists); deleteAllValues(m_floatingFunctions); } @@ -698,10 +702,11 @@ bool CSSParser::parseValue(int propId, bool important) else return parseQuotes(propId, important); break; - case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | inherit - if (id == CSSValueNormal || - id == CSSValueEmbed || - id == CSSValueBidiOverride) + case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | inherit + if (id == CSSValueNormal + || id == CSSValueEmbed + || id == CSSValueBidiOverride + || id == CSSValueWebkitIsolate) validPrimitive = true; break; @@ -838,9 +843,10 @@ bool CSSParser::parseValue(int propId, bool important) break; case CSSPropertyTextAlign: - // left | right | center | justify | webkit_left | webkit_right | webkit_center | start | end | <string> | inherit - if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitCenter) || id == CSSValueStart || id == CSSValueEnd || - value->unit == CSSPrimitiveValue::CSS_STRING) + // left | right | center | justify | webkit_left | webkit_right | webkit_center | webkit_match_parent | + // start | end | <string> | inherit + if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd + || value->unit == CSSPrimitiveValue::CSS_STRING) validPrimitive = true; break; @@ -1887,6 +1893,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitTextEmphasisStyle: return parseTextEmphasisStyle(important); +<<<<<<< HEAD #ifdef ANDROID_CSS_RING case CSSPropertyWebkitRing: { @@ -1924,6 +1931,20 @@ bool CSSParser::parseValue(int propId, bool important) m_valueList->next(); break; #endif +======= + case CSSPropertyWebkitTextOrientation: + // FIXME: For now just support upright and vertical-right. + if (id == CSSValueVerticalRight || id == CSSValueUpright) + validPrimitive = true; + break; + + case CSSPropertyWebkitLineBoxContain: + if (id == CSSValueNone) + validPrimitive = true; + else + return parseLineBoxContain(important); + break; +>>>>>>> webkit.org at r82507 #if ENABLE(SVG) default: @@ -2608,34 +2629,80 @@ bool CSSParser::parseFillImage(RefPtr<CSSValue>& value) return false; } -PassRefPtr<CSSValue> CSSParser::parseFillPositionXY(CSSParserValueList* valueList, bool& xFound, bool& yFound) +PassRefPtr<CSSValue> CSSParser::parseFillPositionX(CSSParserValueList* valueList) +{ + int id = valueList->current()->id; + if (id == CSSValueLeft || id == CSSValueRight || id == CSSValueCenter) { + int percent = 0; + if (id == CSSValueRight) + percent = 100; + else if (id == CSSValueCenter) + percent = 50; + return primitiveValueCache()->createValue(percent, CSSPrimitiveValue::CSS_PERCENTAGE); + } + if (validUnit(valueList->current(), FPercent | FLength, m_strict)) + return primitiveValueCache()->createValue(valueList->current()->fValue, + (CSSPrimitiveValue::UnitTypes)valueList->current()->unit); + return 0; +} + +PassRefPtr<CSSValue> CSSParser::parseFillPositionY(CSSParserValueList* valueList) +{ + int id = valueList->current()->id; + if (id == CSSValueTop || id == CSSValueBottom || id == CSSValueCenter) { + int percent = 0; + if (id == CSSValueBottom) + percent = 100; + else if (id == CSSValueCenter) + percent = 50; + return primitiveValueCache()->createValue(percent, CSSPrimitiveValue::CSS_PERCENTAGE); + } + if (validUnit(valueList->current(), FPercent | FLength, m_strict)) + return primitiveValueCache()->createValue(valueList->current()->fValue, + (CSSPrimitiveValue::UnitTypes)valueList->current()->unit); + return 0; +} + +PassRefPtr<CSSValue> CSSParser::parseFillPositionComponent(CSSParserValueList* valueList, unsigned& cumulativeFlags, FillPositionFlag& individualFlag) { int id = valueList->current()->id; if (id == CSSValueLeft || id == CSSValueTop || id == CSSValueRight || id == CSSValueBottom || id == CSSValueCenter) { int percent = 0; if (id == CSSValueLeft || id == CSSValueRight) { - if (xFound) + if (cumulativeFlags & XFillPosition) return 0; - xFound = true; + cumulativeFlags |= XFillPosition; + individualFlag = XFillPosition; if (id == CSSValueRight) percent = 100; } else if (id == CSSValueTop || id == CSSValueBottom) { - if (yFound) + if (cumulativeFlags & YFillPosition) return 0; - yFound = true; + cumulativeFlags |= YFillPosition; + individualFlag = YFillPosition; if (id == CSSValueBottom) percent = 100; - } - else if (id == CSSValueCenter) + } else if (id == CSSValueCenter) { // Center is ambiguous, so we're not sure which position we've found yet, an x or a y. percent = 50; + cumulativeFlags |= AmbiguousFillPosition; + individualFlag = AmbiguousFillPosition; + } return primitiveValueCache()->createValue(percent, CSSPrimitiveValue::CSS_PERCENTAGE); } - if (validUnit(valueList->current(), FPercent | FLength, m_strict)) + if (validUnit(valueList->current(), FPercent | FLength, m_strict)) { + if (!cumulativeFlags) { + cumulativeFlags |= XFillPosition; + individualFlag = XFillPosition; + } else if (cumulativeFlags & (XFillPosition | AmbiguousFillPosition)) { + cumulativeFlags |= YFillPosition; + individualFlag = YFillPosition; + } else + return 0; return primitiveValueCache()->createValue(valueList->current()->fValue, - (CSSPrimitiveValue::UnitTypes)valueList->current()->unit); - + (CSSPrimitiveValue::UnitTypes)valueList->current()->unit); + } return 0; } @@ -2644,8 +2711,10 @@ void CSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue CSSParserValue* value = valueList->current(); // Parse the first value. We're just making sure that it is one of the valid keywords or a percentage/length. - bool value1IsX = false, value1IsY = false; - value1 = parseFillPositionXY(valueList, value1IsX, value1IsY); + unsigned cumulativeFlags = 0; + FillPositionFlag value1Flag = InvalidFillPosition; + FillPositionFlag value2Flag = InvalidFillPosition; + value1 = parseFillPositionComponent(valueList, cumulativeFlags, value1Flag); if (!value1) return; @@ -2658,9 +2727,8 @@ void CSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue if (value && value->unit == CSSParserValue::Operator && value->iValue == ',') value = 0; - bool value2IsX = false, value2IsY = false; if (value) { - value2 = parseFillPositionXY(valueList, value2IsX, value2IsY); + value2 = parseFillPositionComponent(valueList, cumulativeFlags, value2Flag); if (value2) valueList->next(); else { @@ -2678,7 +2746,7 @@ void CSSParser::parseFillPosition(CSSParserValueList* valueList, RefPtr<CSSValue // For left/right/center, the default of 50% in the y is still correct. value2 = primitiveValueCache()->createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE); - if (value1IsY || value2IsX) + if (value1Flag == YFillPosition || value2Flag == XFillPosition) value1.swap(value2); } @@ -2856,16 +2924,14 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, break; case CSSPropertyBackgroundPositionX: case CSSPropertyWebkitMaskPositionX: { - bool xFound = false, yFound = true; - currValue = parseFillPositionXY(m_valueList, xFound, yFound); + currValue = parseFillPositionX(m_valueList); if (currValue) m_valueList->next(); break; } case CSSPropertyBackgroundPositionY: case CSSPropertyWebkitMaskPositionY: { - bool xFound = true, yFound = false; - currValue = parseFillPositionXY(m_valueList, xFound, yFound); + currValue = parseFillPositionY(m_valueList); if (currValue) m_valueList->next(); break; @@ -3940,10 +4006,76 @@ bool CSSParser::parseFontFaceUnicodeRange() return true; } -static inline bool parseColorInt(const UChar*& string, const UChar* end, UChar terminator, int& value) +// Returns the number of characters which form a valid double +// and are terminated by the given terminator character +static int checkForValidDouble(const UChar* string, const UChar* end, const char terminator) +{ + int length = end - string; + if (length < 1) + return 0; + + bool decimalMarkSeen = false; + int processedLength = 0; + + for (int i = 0; i < length; ++i) { + if (string[i] == terminator) { + processedLength = i; + break; + } + if (!isASCIIDigit(string[i])) { + if (!decimalMarkSeen && string[i] == '.') + decimalMarkSeen = true; + else + return 0; + } + } + + if (decimalMarkSeen && processedLength == 1) + return 0; + + return processedLength; +} + +// Returns the number of characters consumed for parsing a valid double +// terminated by the given terminator character +static int parseDouble(const UChar* string, const UChar* end, const char terminator, double& value) +{ + int length = checkForValidDouble(string, end, terminator); + if (!length) + return 0; + + int position = 0; + double localValue = 0; + + // The consumed characters here are guaranteed to be + // ASCII digits with or without a decimal mark + for (; position < length; ++position) { + if (string[position] == '.') + break; + localValue = localValue * 10 + string[position] - '0'; + } + + if (++position == length) { + value = localValue; + return length; + } + + double fraction = 0; + double scale = 1; + + while (position < length && scale < MAX_SCALE) { + fraction = fraction * 10 + string[position++] - '0'; + scale *= 10; + } + + value = localValue + fraction / scale; + return length; +} + +static bool parseColorIntOrPercentage(const UChar*& string, const UChar* end, const char terminator, CSSPrimitiveValue::UnitTypes& expect, int& value) { const UChar* current = string; - int localValue = 0; + double localValue = 0; bool negative = false; while (current != end && isHTMLSpace(*current)) current++; @@ -3954,7 +4086,7 @@ static inline bool parseColorInt(const UChar*& string, const UChar* end, UChar t if (current == end || !isASCIIDigit(*current)) return false; while (current != end && isASCIIDigit(*current)) { - int newValue = localValue * 10 + *current++ - '0'; + double newValue = localValue * 10 + *current++ - '0'; if (newValue >= 255) { // Clamp values at 255. localValue = 255; @@ -3964,12 +4096,42 @@ static inline bool parseColorInt(const UChar*& string, const UChar* end, UChar t } localValue = newValue; } + + if (expect == CSSPrimitiveValue::CSS_NUMBER && (*current == '.' || *current == '%')) + return false; + + if (*current == '.') { + // We already parsed the integral part, try to parse + // the fraction part of the percentage value. + double percentage = 0; + int numCharactersParsed = parseDouble(current, end, '%', percentage); + if (!numCharactersParsed) + return false; + current += numCharactersParsed; + if (*current != '%') + return false; + localValue += percentage; + } + + if (expect == CSSPrimitiveValue::CSS_PERCENTAGE && *current != '%') + return false; + + if (*current == '%') { + expect = CSSPrimitiveValue::CSS_PERCENTAGE; + localValue = localValue / 100.0 * 256.0; + // Clamp values at 255 for percentages over 100% + if (localValue > 255) + localValue = 255; + current++; + } else + expect = CSSPrimitiveValue::CSS_NUMBER; + while (current != end && isHTMLSpace(*current)) current++; if (current == end || *current++ != terminator) return false; // Clamp negative values at zero. - value = negative ? 0 : localValue; + value = negative ? 0 : static_cast<int>(localValue); string = current; return true; } @@ -3987,21 +4149,7 @@ static inline bool isTenthAlpha(const UChar* string, const int length) return false; } -static inline bool isValidDouble(const UChar* string, const int length) -{ - bool decimalMarkSeen = false; - for (int i = 0; i < length; ++i) { - if (!isASCIIDigit(string[i])) { - if (!decimalMarkSeen && string[i] == '.') - decimalMarkSeen = true; - else - return false; - } - } - return true; -} - -static inline bool parseAlphaValue(const UChar*& string, const UChar* end, UChar terminator, int& value) +static inline bool parseAlphaValue(const UChar*& string, const UChar* end, const char terminator, int& value) { while (string != end && isHTMLSpace(*string)) string++; @@ -4023,7 +4171,7 @@ static inline bool parseAlphaValue(const UChar*& string, const UChar* end, UChar return false; if (string[0] != '0' && string[0] != '1' && string[0] != '.') { - if (isValidDouble(string, length - 1)) { + if (checkForValidDouble(string, end, terminator)) { value = negative ? 0 : 255; string = end; return true; @@ -4044,20 +4192,12 @@ static inline bool parseAlphaValue(const UChar*& string, const UChar* end, UChar return true; } - if (!isValidDouble(string, length - 1)) - return false; - - Vector<char, 8> bytes(length + 1); - - for (int i = 0; i < length; ++i) - bytes[i] = string[i]; - - bytes[length] = '\0'; - char* foundTerminator; - double d = WTF::strtod(bytes.data(), &foundTerminator); - value = negative ? 0 : static_cast<int>(d * nextafter(256.0, 0.0)); - string += (foundTerminator - bytes.data()) + 1; - return *foundTerminator == terminator; + double alpha = 0; + if (!parseDouble(string, end, terminator, alpha)) + return false; + value = negative ? 0 : static_cast<int>(alpha * nextafter(256.0, 0.0)); + string = end; + return true; } static inline bool mightBeRGBA(const UChar* characters, unsigned length) @@ -4085,6 +4225,7 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) { const UChar* characters = name.characters(); unsigned length = name.length(); + CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::CSS_UNKNOWN; if (!strict && length >= 3) { if (name[0] == '#') { @@ -4104,11 +4245,12 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) int green; int blue; int alpha; - if (!parseColorInt(current, end, ',', red)) + + if (!parseColorIntOrPercentage(current, end, ',', expect, red)) return false; - if (!parseColorInt(current, end, ',', green)) + if (!parseColorIntOrPercentage(current, end, ',', expect, green)) return false; - if (!parseColorInt(current, end, ',', blue)) + if (!parseColorIntOrPercentage(current, end, ',', expect, blue)) return false; if (!parseAlphaValue(current, end, ')', alpha)) return false; @@ -4125,11 +4267,11 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) int red; int green; int blue; - if (!parseColorInt(current, end, ',', red)) + if (!parseColorIntOrPercentage(current, end, ',', expect, red)) return false; - if (!parseColorInt(current, end, ',', green)) + if (!parseColorIntOrPercentage(current, end, ',', expect, green)) return false; - if (!parseColorInt(current, end, ')', blue)) + if (!parseColorIntOrPercentage(current, end, ')', expect, blue)) return false; if (current != end) return false; @@ -5544,15 +5686,13 @@ bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int // parseTransformOriginShorthand advances the m_valueList pointer break; case CSSPropertyWebkitTransformOriginX: { - bool xFound = false, yFound = true; - value = parseFillPositionXY(m_valueList, xFound, yFound); + value = parseFillPositionX(m_valueList); if (value) m_valueList->next(); break; } case CSSPropertyWebkitTransformOriginY: { - bool xFound = true, yFound = false; - value = parseFillPositionXY(m_valueList, xFound, yFound); + value = parseFillPositionY(m_valueList); if (value) m_valueList->next(); break; @@ -5583,15 +5723,13 @@ bool CSSParser::parsePerspectiveOrigin(int propId, int& propId1, int& propId2, R parseFillPosition(m_valueList, value, value2); break; case CSSPropertyWebkitPerspectiveOriginX: { - bool xFound = false, yFound = true; - value = parseFillPositionXY(m_valueList, xFound, yFound); + value = parseFillPositionX(m_valueList); if (value) m_valueList->next(); break; } case CSSPropertyWebkitPerspectiveOriginY: { - bool xFound = true, yFound = false; - value = parseFillPositionXY(m_valueList, xFound, yFound); + value = parseFillPositionY(m_valueList); if (value) m_valueList->next(); break; @@ -5658,6 +5796,46 @@ bool CSSParser::parseTextEmphasisStyle(bool important) return false; } +bool CSSParser::parseLineBoxContain(bool important) +{ + LineBoxContain lineBoxContain = LineBoxContainNone; + + for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) { + if (value->id == CSSValueBlock) { + if (lineBoxContain & LineBoxContainBlock) + return false; + lineBoxContain |= LineBoxContainBlock; + } else if (value->id == CSSValueInline) { + if (lineBoxContain & LineBoxContainInline) + return false; + lineBoxContain |= LineBoxContainInline; + } else if (value->id == CSSValueFont) { + if (lineBoxContain & LineBoxContainFont) + return false; + lineBoxContain |= LineBoxContainFont; + } else if (value->id == CSSValueGlyphs) { + if (lineBoxContain & LineBoxContainGlyphs) + return false; + lineBoxContain |= LineBoxContainGlyphs; + } else if (value->id == CSSValueReplaced) { + if (lineBoxContain & LineBoxContainReplaced) + return false; + lineBoxContain |= LineBoxContainReplaced; + } else if (value->id == CSSValueInlineBox) { + if (lineBoxContain & LineBoxContainInlineBox) + return false; + lineBoxContain |= LineBoxContainInlineBox; + } else + return false; + } + + if (!lineBoxContain) + return false; + + addProperty(CSSPropertyWebkitLineBoxContain, CSSLineBoxContainValue::create(lineBoxContain), important); + return true; +} + static inline int yyerror(const char*) { return 1; } #define END_TOKEN 0 @@ -5689,6 +5867,7 @@ int CSSParser::lex(void* yylvalWithoutType) case DIMEN: case UNICODERANGE: case FUNCTION: + case ANYFUNCTION: case NOTFUNCTION: yylval->string.characters = t; yylval->string.length = length; @@ -5902,6 +6081,22 @@ PassOwnPtr<CSSParserSelector> CSSParser::sinkFloatingSelector(CSSParserSelector* return adoptPtr(selector); } +Vector<OwnPtr<CSSParserSelector> >* CSSParser::createFloatingSelectorVector() +{ + Vector<OwnPtr<CSSParserSelector> >* selectorVector = new Vector<OwnPtr<CSSParserSelector> >; + m_floatingSelectorVectors.add(selectorVector); + return selectorVector; +} + +Vector<OwnPtr<CSSParserSelector> >* CSSParser::sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectorVector) +{ + if (selectorVector) { + ASSERT(m_floatingSelectorVectors.contains(selectorVector)); + m_floatingSelectorVectors.remove(selectorVector); + } + return selectorVector; +} + CSSParserValueList* CSSParser::createFloatingValueList() { CSSParserValueList* list = new CSSParserValueList; @@ -6485,11 +6680,8 @@ String quoteCSSString(const String& string) buffer[index++] = ch; afterEscape = false; } else if (ch < 0x20 || ch == 0x7F) { // Control characters. - static const char hexDigits[17] = "0123456789abcdef"; buffer[index++] = '\\'; - if (ch >= 0x10) - buffer[index++] = hexDigits[ch >> 4]; - buffer[index++] = hexDigits[ch & 0xF]; + placeByteAsHexCompressIfPossible(ch, buffer, index, Lowercase); afterEscape = true; } else { // Space character may be required to separate backslash-escape sequence and normal characters. diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index 230e699..c03afd9 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -89,8 +89,13 @@ namespace WebCore { PassRefPtr<CSSValue> parseBackgroundColor(); bool parseFillImage(RefPtr<CSSValue>&); - PassRefPtr<CSSValue> parseFillPositionXY(CSSParserValueList*, bool& xFound, bool& yFound); + + enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 }; + PassRefPtr<CSSValue> parseFillPositionComponent(CSSParserValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag); + PassRefPtr<CSSValue> parseFillPositionX(CSSParserValueList*); + PassRefPtr<CSSValue> parseFillPositionY(CSSParserValueList*); void parseFillPosition(CSSParserValueList*, RefPtr<CSSValue>&, RefPtr<CSSValue>&); + void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&); PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma); @@ -173,11 +178,16 @@ namespace WebCore { bool parseTextEmphasisStyle(bool important); + bool parseLineBoxContain(bool important); + int yyparse(); CSSParserSelector* createFloatingSelector(); PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*); + Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector(); + Vector<OwnPtr<CSSParserSelector> >* sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >*); + CSSParserValueList* createFloatingValueList(); CSSParserValueList* sinkFloatingValueList(CSSParserValueList*); @@ -311,6 +321,7 @@ namespace WebCore { Vector<RefPtr<StyleBase> > m_parsedStyleObjects; Vector<RefPtr<CSSRuleList> > m_parsedRuleLists; HashSet<CSSParserSelector*> m_floatingSelectors; + HashSet<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors; HashSet<CSSParserValueList*> m_floatingValueLists; HashSet<CSSParserFunction*> m_floatingFunctions; diff --git a/Source/WebCore/css/CSSParserValues.cpp b/Source/WebCore/css/CSSParserValues.cpp index dc0e82b..94dcd3c 100644 --- a/Source/WebCore/css/CSSParserValues.cpp +++ b/Source/WebCore/css/CSSParserValues.cpp @@ -25,6 +25,7 @@ #include "CSSFunctionValue.h" #include "CSSQuirkPrimitiveValue.h" #include "CSSSelector.h" +#include "CSSSelectorList.h" namespace WebCore { @@ -43,12 +44,23 @@ void CSSParserValueList::addValue(const CSSParserValue& v) { m_values.append(v); } - + +void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& v) +{ + m_values.insert(i, v); +} + void CSSParserValueList::deleteValueAt(unsigned i) { m_values.remove(i); } +void CSSParserValueList::extend(CSSParserValueList& valueList) +{ + for (unsigned int i = 0; i < valueList.size(); ++i) + m_values.append(*(valueList.valueAt(i))); +} + PassRefPtr<CSSValue> CSSParserValue::createCSSValue() { RefPtr<CSSValue> parsedValue; @@ -96,5 +108,11 @@ CSSParserSelector::~CSSParserSelector() deleteAllValues(toDelete); } +void CSSParserSelector::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector) +{ + CSSSelectorList* selectorList = fastNew<CSSSelectorList>(); + selectorList->adoptSelectorVector(selectorVector); + m_selector->setSelectorList(adoptPtr(selectorList)); +} } diff --git a/Source/WebCore/css/CSSParserValues.h b/Source/WebCore/css/CSSParserValues.h index d084091..81ecbc3 100644 --- a/Source/WebCore/css/CSSParserValues.h +++ b/Source/WebCore/css/CSSParserValues.h @@ -71,7 +71,9 @@ public: ~CSSParserValueList(); void addValue(const CSSParserValue&); + void insertValueAt(unsigned, const CSSParserValue&); void deleteValueAt(unsigned); + void extend(CSSParserValueList&); unsigned size() const { return m_values.size(); } CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; } @@ -105,11 +107,12 @@ public: void setValue(const AtomicString& value) { m_selector->setValue(value); } void setAttribute(const QualifiedName& value) { m_selector->setAttribute(value); } void setArgument(const AtomicString& value) { m_selector->setArgument(value); } - void setSimpleSelector(PassOwnPtr<CSSSelector> value) { m_selector->setSimpleSelector(value); } void setMatch(CSSSelector::Match value) { m_selector->m_match = value; } void setRelation(CSSSelector::Relation value) { m_selector->m_relation = value; } void setForPage() { m_selector->setForPage(); } - + + void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector); + CSSSelector::PseudoType pseudoType() const { return m_selector->pseudoType(); } bool isUnknownPseudoElement() const { return m_selector->isUnknownPseudoElement(); } bool isSimple() const { return !m_tagHistory && m_selector->isSimple(); } diff --git a/Source/WebCore/css/CSSPrimitiveValueCache.cpp b/Source/WebCore/css/CSSPrimitiveValueCache.cpp index 6b3eebe..5c7a4c0 100644 --- a/Source/WebCore/css/CSSPrimitiveValueCache.cpp +++ b/Source/WebCore/css/CSSPrimitiveValueCache.cpp @@ -23,7 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include <config.h> +#include "config.h" #include "CSSPrimitiveValueCache.h" namespace WebCore { diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index fb4aff3..16412ad 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -39,6 +39,7 @@ #include "RenderStyleConstants.h" #include "SVGRenderStyleDefs.h" #include "TextDirection.h" +#include "TextOrientation.h" #include "TextRenderingMode.h" #include "ThemeTypes.h" @@ -1616,30 +1617,36 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e) , m_hasCachedCSSText(false) { switch (e) { - case TAAUTO: - m_value.ident = CSSValueWebkitAuto; - break; - case LEFT: - m_value.ident = CSSValueLeft; - break; - case RIGHT: - m_value.ident = CSSValueRight; - break; - case CENTER: - m_value.ident = CSSValueCenter; - break; - case JUSTIFY: - m_value.ident = CSSValueJustify; - break; - case WEBKIT_LEFT: - m_value.ident = CSSValueWebkitLeft; - break; - case WEBKIT_RIGHT: - m_value.ident = CSSValueWebkitRight; - break; - case WEBKIT_CENTER: - m_value.ident = CSSValueWebkitCenter; - break; + case TAAUTO: + m_value.ident = CSSValueWebkitAuto; + break; + case TASTART: + m_value.ident = CSSValueStart; + break; + case TAEND: + m_value.ident = CSSValueEnd; + break; + case LEFT: + m_value.ident = CSSValueLeft; + break; + case RIGHT: + m_value.ident = CSSValueRight; + break; + case CENTER: + m_value.ident = CSSValueCenter; + break; + case JUSTIFY: + m_value.ident = CSSValueJustify; + break; + case WEBKIT_LEFT: + m_value.ident = CSSValueWebkitLeft; + break; + case WEBKIT_RIGHT: + m_value.ident = CSSValueWebkitRight; + break; + case WEBKIT_CENTER: + m_value.ident = CSSValueWebkitCenter; + break; } } @@ -1647,9 +1654,9 @@ template<> inline CSSPrimitiveValue::operator ETextAlign() const { switch (m_value.ident) { case CSSValueStart: + return TASTART; case CSSValueEnd: - ASSERT_NOT_REACHED(); // Depends on direction, thus should be handled by the caller. - return LEFT; + return TAEND; default: return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto); } @@ -1734,30 +1741,34 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e) , m_hasCachedCSSText(false) { switch (e) { - case UBNormal: - m_value.ident = CSSValueNormal; - break; - case Embed: - m_value.ident = CSSValueEmbed; - break; - case Override: - m_value.ident = CSSValueBidiOverride; - break; + 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; } } template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const { switch (m_value.ident) { - case CSSValueNormal: - return UBNormal; - case CSSValueEmbed: - return Embed; - case CSSValueBidiOverride: - return Override; - default: - ASSERT_NOT_REACHED(); - return UBNormal; + case CSSValueNormal: + return UBNormal; + case CSSValueEmbed: + return Embed; + case CSSValueBidiOverride: + return Override; + case CSSValueWebkitIsolate: + return Isolate; + default: + ASSERT_NOT_REACHED(); + return UBNormal; } } @@ -2177,6 +2188,33 @@ template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e) + : m_type(CSS_IDENT) + , m_hasCachedCSSText(false) +{ + switch (e) { + case TextOrientationVerticalRight: + m_value.ident = CSSValueVerticalRight; + break; + case TextOrientationUpright: + m_value.ident = CSSValueUpright; + break; + } +} + +template<> inline CSSPrimitiveValue::operator TextOrientation() const +{ + switch (m_value.ident) { + case CSSValueVerticalRight: + return TextOrientationVerticalRight; + case CSSValueUpright: + return TextOrientationUpright; + default: + ASSERT_NOT_REACHED(); + return TextOrientationVerticalRight; + } +} + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e) : m_type(CSS_IDENT) , m_hasCachedCSSText(false) diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index d1fdcd3..a62d2f3 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -21,6 +21,7 @@ font-variant font-weight text-rendering -webkit-font-smoothing +-webkit-text-orientation -webkit-text-size-adjust -webkit-writing-mode zoom @@ -230,6 +231,7 @@ z-index -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphens +-webkit-line-box-contain -webkit-line-break -webkit-line-clamp -webkit-locale diff --git a/Source/WebCore/css/CSSRuleList.h b/Source/WebCore/css/CSSRuleList.h index a355c4a..87996a9 100644 --- a/Source/WebCore/css/CSSRuleList.h +++ b/Source/WebCore/css/CSSRuleList.h @@ -53,6 +53,11 @@ public: void deleteRule(unsigned index); void append(CSSRule*); + StyleList* styleList() + { + return m_list.get(); + } + private: CSSRuleList(); CSSRuleList(StyleList*, bool omitCharsetRules); diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp index c804697..a87d4f3 100644 --- a/Source/WebCore/css/CSSSelector.cpp +++ b/Source/WebCore/css/CSSSelector.cpp @@ -27,6 +27,7 @@ #include "CSSSelector.h" #include "CSSOMUtils.h" +#include "CSSSelectorList.h" #include "HTMLNames.h" #include <wtf/Assertions.h> #include <wtf/HashMap.h> @@ -78,9 +79,12 @@ inline unsigned CSSSelector::specificityForOneSelector() const case Contain: case Begin: case End: - if (pseudoType() == PseudoNot && simpleSelector()) - s += simpleSelector()->specificityForOneSelector(); - else + // FIXME: PsuedoAny should base the specificity on the sub-selectors. + // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html + if (pseudoType() == PseudoNot) { + ASSERT(selectorList()); + s += selectorList()->first()->specificityForOneSelector(); + } else s += 0x100; case None: break; @@ -211,6 +215,7 @@ PseudoId CSSSelector::pseudoId(PseudoType type) case PseudoNthLastOfType: case PseudoLink: case PseudoVisited: + case PseudoAny: case PseudoAnyLink: case PseudoAutofill: case PseudoHover: @@ -265,6 +270,7 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* 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")); @@ -364,6 +370,7 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(active.impl(), CSSSelector::PseudoActive); nameToPseudoType->set(after.impl(), CSSSelector::PseudoAfter); nameToPseudoType->set(anyLink.impl(), CSSSelector::PseudoAnyLink); + nameToPseudoType->set(any.impl(), CSSSelector::PseudoAny); nameToPseudoType->set(autofill.impl(), CSSSelector::PseudoAutofill); nameToPseudoType->set(before.impl(), CSSSelector::PseudoBefore); nameToPseudoType->set(checked.impl(), CSSSelector::PseudoChecked); @@ -527,6 +534,7 @@ void CSSSelector::extractPseudoType() const case PseudoNthLastOfType: case PseudoLink: case PseudoVisited: + case PseudoAny: case PseudoAnyLink: case PseudoAutofill: case PseudoHover: @@ -638,17 +646,33 @@ String CSSSelector::selectorText() const } else if (cs->m_match == CSSSelector::PseudoClass || cs->m_match == CSSSelector::PagePseudoClass) { str += ":"; str += cs->value(); - if (cs->pseudoType() == PseudoNot) { - if (CSSSelector* subSel = cs->simpleSelector()) - str += subSel->selectorText(); + + switch (cs->pseudoType()) { + case PseudoNot: + ASSERT(cs->selectorList()); + str += cs->selectorList()->first()->selectorText(); str += ")"; - } else if (cs->pseudoType() == PseudoLang - || cs->pseudoType() == PseudoNthChild - || cs->pseudoType() == PseudoNthLastChild - || cs->pseudoType() == PseudoNthOfType - || cs->pseudoType() == PseudoNthLastOfType) { + break; + case PseudoLang: + case PseudoNthChild: + case PseudoNthLastChild: + case PseudoNthOfType: + case PseudoNthLastOfType: str += cs->argument(); str += ")"; + break; + case PseudoAny: { + CSSSelector* firstSubSelector = cs->selectorList()->first(); + for (CSSSelector* subSelector = firstSubSelector; subSelector; subSelector = CSSSelectorList::next(subSelector)) { + if (subSelector != firstSubSelector) + str += ","; + str += subSelector->selectorText(); + } + str += ")"; + break; + } + default: + break; } } else if (cs->m_match == CSSSelector::PseudoElement) { str += "::"; @@ -736,11 +760,11 @@ void CSSSelector::setArgument(const AtomicString& value) createRareData(); m_data.m_rareData->m_argument = value; } - -void CSSSelector::setSimpleSelector(PassOwnPtr<CSSSelector> value) + +void CSSSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList) { createRareData(); - m_data.m_rareData->m_simpleSelector = value; + m_data.m_rareData->m_selectorList = selectorList; } bool CSSSelector::parseNth() @@ -761,7 +785,7 @@ bool CSSSelector::matchNth(int count) bool CSSSelector::isSimple() const { - if (simpleSelector() || tagHistory() || matchesPseudoElement()) + if (selectorList() || tagHistory() || matchesPseudoElement()) return false; int numConditions = 0; @@ -784,6 +808,21 @@ bool CSSSelector::isSimple() const return numConditions <= 1; } +CSSSelector::RareData::RareData(PassRefPtr<AtomicStringImpl> value) + : m_value(value.leakRef()) + , m_a(0) + , m_b(0) + , m_attribute(anyQName()) + , m_argument(nullAtom) +{ +} + +CSSSelector::RareData::~RareData() +{ + if (m_value) + m_value->deref(); +} + // a helper function for parsing nth-arguments bool CSSSelector::RareData::parseNth() { diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h index c04c27b..fdadafa 100644 --- a/Source/WebCore/css/CSSSelector.h +++ b/Source/WebCore/css/CSSSelector.h @@ -29,6 +29,7 @@ #include <wtf/PassOwnPtr.h> namespace WebCore { + class CSSSelectorList; // this class represents a selector for a StyleRule class CSSSelector { @@ -129,6 +130,7 @@ namespace WebCore { PseudoNthLastOfType, PseudoLink, PseudoVisited, + PseudoAny, PseudoAnyLink, PseudoAutofill, PseudoHover, @@ -247,13 +249,13 @@ namespace WebCore { const AtomicString& value() const { return *reinterpret_cast<const AtomicString*>(m_hasRareData ? &m_data.m_rareData->m_value : &m_data.m_value); } const QualifiedName& attribute() const; const AtomicString& argument() const { return m_hasRareData ? m_data.m_rareData->m_argument : nullAtom; } - CSSSelector* simpleSelector() const { return m_hasRareData ? m_data.m_rareData->m_simpleSelector.get() : 0; } + CSSSelectorList* selectorList() const { return m_hasRareData ? m_data.m_rareData->m_selectorList.get() : 0; } void setTag(const QualifiedName& value) { m_tag = value; } void setValue(const AtomicString&); void setAttribute(const QualifiedName&); void setArgument(const AtomicString&); - void setSimpleSelector(PassOwnPtr<CSSSelector>); + void setSelectorList(PassOwnPtr<CSSSelectorList>); bool parseNth(); bool matchNth(int count); @@ -284,7 +286,7 @@ namespace WebCore { bool m_isLastInTagHistory : 1; bool m_hasRareData : 1; bool m_isForPage : 1; - // FIXME: Remove once http://webkit.org/b/53045 is fixed. + // FIXME: Remove once http://webkit.org/b/56124 is fixed. bool m_deleted : 1; unsigned specificityForOneSelector() const; @@ -294,19 +296,8 @@ namespace WebCore { struct RareData { WTF_MAKE_NONCOPYABLE(RareData); WTF_MAKE_FAST_ALLOCATED; public: - RareData(PassRefPtr<AtomicStringImpl> value) - : m_value(value.leakRef()) - , m_a(0) - , m_b(0) - , m_attribute(anyQName()) - , m_argument(nullAtom) - { - } - ~RareData() - { - if (m_value) - m_value->deref(); - } + RareData(PassRefPtr<AtomicStringImpl> value); + ~RareData(); bool parseNth(); bool matchNth(int count); @@ -314,9 +305,9 @@ namespace WebCore { AtomicStringImpl* m_value; // Plain pointer to keep things uniform with the union. int m_a; // Used for :nth-* int m_b; // Used for :nth-* - OwnPtr<CSSSelector> m_simpleSelector; // Used for :not. QualifiedName m_attribute; // used for attribute selector AtomicString m_argument; // Used for :contains, :lang and :nth-* + OwnPtr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not }; void createRareData(); diff --git a/Source/WebCore/css/CSSSelectorList.cpp b/Source/WebCore/css/CSSSelectorList.cpp index 6f307ee..c0ffdd5 100644 --- a/Source/WebCore/css/CSSSelectorList.cpp +++ b/Source/WebCore/css/CSSSelectorList.cpp @@ -87,7 +87,7 @@ void CSSSelectorList::deleteSelectors() if (!m_selectorArray) return; - // FIXME: Remove once http://webkit.org/b/53045 is fixed. + // FIXME: Remove once http://webkit.org/b/56124 is fixed. if (m_selectorArray == freedSelectorArrayMarker) CRASH(); @@ -122,9 +122,11 @@ static bool forEachTagSelector(Functor& functor, CSSSelector* selector) do { if (functor(selector)) return true; - if (CSSSelector* simpleSelector = selector->simpleSelector()) { - if (forEachTagSelector(functor, simpleSelector)) - return true; + if (CSSSelectorList* selectorList = selector->selectorList()) { + for (CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = CSSSelectorList::next(subSelector)) { + if (forEachTagSelector(functor, subSelector)) + return true; + } } } while ((selector = selector->tagHistory())); diff --git a/Source/WebCore/css/CSSStyleApplyProperty.cpp b/Source/WebCore/css/CSSStyleApplyProperty.cpp new file mode 100644 index 0000000..e075615 --- /dev/null +++ b/Source/WebCore/css/CSSStyleApplyProperty.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CSSStyleApplyProperty.h" + +#include "CSSPrimitiveValueMappings.h" +#include "CSSStyleSelector.h" +#include "RenderStyle.h" +#include <wtf/StdLibExtras.h> +#include <wtf/UnusedParam.h> + +using namespace std; + +namespace WebCore { + +class ApplyPropertyNull : public ApplyPropertyBase { +public: + virtual void inherit(CSSStyleSelector*) const {} + virtual void initial(CSSStyleSelector*) const {} + virtual void value(CSSStyleSelector*, CSSValue*) const {} +}; + +template <typename T> +class ApplyPropertyDefault : public ApplyPropertyBase { +public: + ApplyPropertyDefault(T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T), T (*initial)()) + : m_getter(getter) + , m_setter(setter) + , m_initial(initial) + { + } + + virtual void inherit(CSSStyleSelector* selector) const + { + (selector->style()->*m_setter)((selector->parentStyle()->*m_getter)()); + } + + virtual void initial(CSSStyleSelector* selector) const + { + (selector->style()->*m_setter)((*m_initial)()); + } + + virtual void value(CSSStyleSelector* selector, CSSValue* value) const + { + if (value->isPrimitiveValue()) + (selector->style()->*m_setter)(*(static_cast<CSSPrimitiveValue*>(value))); + } + +protected: + T (RenderStyle::*m_getter)() const; + void (RenderStyle::*m_setter)(T); + T (*m_initial)(); +}; + +// CSSPropertyColor +class ApplyPropertyColorBase : public ApplyPropertyBase { +public: + ApplyPropertyColorBase(const Color& (RenderStyle::*getter)() const, const Color& (RenderStyle::*defaultValue)() const, void (RenderStyle::*setter)(const Color&)) + : m_getter(getter) + , m_defaultValue(defaultValue) + , m_setter(setter) + { + } + virtual void inherit(CSSStyleSelector* selector) const + { + const Color& color = (selector->parentStyle()->*m_getter)(); + if (m_defaultValue && !color.isValid()) + (selector->style()->*m_setter)((selector->parentStyle()->*m_defaultValue)()); + else + (selector->style()->*m_setter)(color); + } + virtual void initial(CSSStyleSelector* selector) const + { + Color color; + (selector->style()->*m_setter)(color); + } + virtual void value(CSSStyleSelector* selector, CSSValue* value) const + { + if (value->isPrimitiveValue()) + (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(static_cast<CSSPrimitiveValue*>(value))); + } +protected: + const Color& (RenderStyle::*m_getter)() const; + const Color& (RenderStyle::*m_defaultValue)() const; + void (RenderStyle::*m_setter)(const Color&); +}; + +class ApplyPropertyColor : public ApplyPropertyColorBase { +public: + ApplyPropertyColor(const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), Color (*initialValue)()) + : ApplyPropertyColorBase(getter, 0, setter) + , m_initialValue(initialValue) + { + } + + virtual void initial(CSSStyleSelector* selector) const + { + (selector->style()->*m_setter)(m_initialValue()); + } + + virtual void value(CSSStyleSelector* selector, CSSValue* value) const + { + if (!value->isPrimitiveValue()) + return; + + if ((static_cast<CSSPrimitiveValue*>(value))->getIdent() == CSSValueCurrentcolor) + inherit(selector); + else + ApplyPropertyColorBase::value(selector, value); + } +protected: + Color (*m_initialValue)(); +}; + +const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty() +{ + DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ()); + return cssStyleApplyPropertyInstance; +} + + +CSSStyleApplyProperty::CSSStyleApplyProperty() +{ + for (int i = 0; i < numCSSProperties; ++i) + m_propertyMap[i] = 0; + + setPropertyValue(CSSPropertyColor, new ApplyPropertyColor(&RenderStyle::color, &RenderStyle::setColor, RenderStyle::initialColor)); + setPropertyValue(CSSPropertyBackgroundColor, new ApplyPropertyColorBase(&RenderStyle::backgroundColor, 0, &RenderStyle::setBackgroundColor)); + setPropertyValue(CSSPropertyBorderBottomColor, new ApplyPropertyColorBase(&RenderStyle::borderBottomColor, &RenderStyle::color, &RenderStyle::setBorderBottomColor)); + setPropertyValue(CSSPropertyBorderLeftColor, new ApplyPropertyColorBase(&RenderStyle::borderLeftColor, &RenderStyle::color, &RenderStyle::setBorderLeftColor)); + setPropertyValue(CSSPropertyBorderRightColor, new ApplyPropertyColorBase(&RenderStyle::borderRightColor, &RenderStyle::color, &RenderStyle::setBorderRightColor)); + setPropertyValue(CSSPropertyBorderTopColor, new ApplyPropertyColorBase(&RenderStyle::borderTopColor, &RenderStyle::color, &RenderStyle::setBorderTopColor)); + setPropertyValue(CSSPropertyOutlineColor, new ApplyPropertyColorBase(&RenderStyle::outlineColor, &RenderStyle::color, &RenderStyle::setOutlineColor)); + setPropertyValue(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColorBase(&RenderStyle::columnRuleColor, &RenderStyle::color, &RenderStyle::setColumnRuleColor)); + setPropertyValue(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColorBase(&RenderStyle::textEmphasisColor, &RenderStyle::color, &RenderStyle::setTextEmphasisColor)); + setPropertyValue(CSSPropertyWebkitTextFillColor, new ApplyPropertyColorBase(&RenderStyle::textFillColor, &RenderStyle::color, &RenderStyle::setTextFillColor)); + setPropertyValue(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColorBase(&RenderStyle::textStrokeColor, &RenderStyle::color, &RenderStyle::setTextStrokeColor)); +} + + +} diff --git a/Source/WebCore/css/CSSStyleApplyProperty.h b/Source/WebCore/css/CSSStyleApplyProperty.h new file mode 100644 index 0000000..48e08da --- /dev/null +++ b/Source/WebCore/css/CSSStyleApplyProperty.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CSSStyleApplyProperty_h +#define CSSStyleApplyProperty_h + +#include "CSSPropertyNames.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class CSSStyleSelector; +class CSSValue; +class ApplyPropertyBase { + WTF_MAKE_NONCOPYABLE(ApplyPropertyBase); + WTF_MAKE_FAST_ALLOCATED; +public: + ApplyPropertyBase() { } + virtual ~ApplyPropertyBase() { } + virtual void inherit(CSSStyleSelector*) const = 0; + virtual void initial(CSSStyleSelector*) const = 0; + virtual void value(CSSStyleSelector*, CSSValue*) const = 0; +}; + +class CSSStyleApplyProperty : public RefCounted<CSSStyleApplyProperty> { +public: + static const CSSStyleApplyProperty& sharedCSSStyleApplyProperty(); + + void inherit(CSSPropertyID property, CSSStyleSelector* selector) const + { + ASSERT(implements(property)); + propertyValue(property)->inherit(selector); + } + + void initial(CSSPropertyID property, CSSStyleSelector* selector) const + { + ASSERT(implements(property)); + propertyValue(property)->initial(selector); + } + + void value(CSSPropertyID property, CSSStyleSelector* selector, CSSValue* value) const + { + ASSERT(implements(property)); + propertyValue(property)->value(selector, value); + } + + bool implements(CSSPropertyID property) const + { + return propertyValue(property); + } + +private: + CSSStyleApplyProperty(); + static int index(CSSPropertyID property) + { + return property - firstCSSProperty; + } + + static bool valid(CSSPropertyID property) + { + int i = index(property); + return i >= 0 && i < numCSSProperties; + } + + void setPropertyValue(CSSPropertyID property, ApplyPropertyBase* value) + { + ASSERT(valid(property)); + m_propertyMap[index(property)] = value; + } + + ApplyPropertyBase* propertyValue(CSSPropertyID property) const + { + ASSERT(valid(property)); + return m_propertyMap[index(property)]; + } + + ApplyPropertyBase* m_propertyMap[numCSSProperties]; +}; + +} + +#endif // CSSStyleApplyProperty_h diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index bcf7756..d41e41b 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -35,6 +35,7 @@ #include "CSSCursorImageValue.h" #include "CSSFontFaceRule.h" #include "CSSImportRule.h" +#include "CSSLineBoxContainValue.h" #include "CSSMediaRule.h" #include "CSSPageRule.h" #include "CSSParser.h" @@ -44,6 +45,7 @@ #include "CSSRuleList.h" #include "CSSSelector.h" #include "CSSSelectorList.h" +#include "CSSStyleApplyProperty.h" #include "CSSStyleRule.h" #include "CSSStyleSheet.h" #include "CSSTimingFunctionValue.h" @@ -435,9 +437,6 @@ static RuleSet* siblingRulesInDefaultStyle; RenderStyle* CSSStyleSelector::s_styleNotYetAvailable; static void loadFullDefaultStyle(); -#if ENABLE(FULLSCREEN_API) -static void loadFullScreenRulesIfNeeded(Document*); -#endif static void loadSimpleDefaultStyle(); // FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet. static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}"; @@ -507,6 +506,7 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee , m_styledElement(0) , m_elementLinkState(NotInsideLink) , m_fontSelector(CSSFontSelector::create(document)) + , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty()) { m_matchAuthorAndUserStyles = matchAuthorAndUserStyles; @@ -517,9 +517,6 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee loadSimpleDefaultStyle(); else { loadFullDefaultStyle(); -#if ENABLE(FULLSCREEN_API) - loadFullScreenRulesIfNeeded(document); -#endif } } @@ -654,19 +651,6 @@ static void loadFullDefaultStyle() defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval()); } -#if ENABLE(FULLSCREEN_API) -static void loadFullScreenRulesIfNeeded(Document* document) -{ - if (!document->webkitIsFullScreen()) - return; - // Full-screen rules. - String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet(); - CSSStyleSheet* fullscreenSheet = parseUASheet(fullscreenRules); - defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval()); - defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval()); -} -#endif - static void loadSimpleDefaultStyle() { ASSERT(!defaultStyle); @@ -1131,8 +1115,8 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* node) const return false; if (isControl) { - InputElement* thisInputElement = toInputElement(element); - InputElement* otherInputElement = toInputElement(m_element); + InputElement* thisInputElement = element->toInputElement(); + InputElement* otherInputElement = m_element->toInputElement(); if (!thisInputElement || !otherInputElement) return false; @@ -1386,9 +1370,6 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) { loadFullDefaultStyle(); -#if ENABLE(FULLSCREEN_API) - loadFullScreenRulesIfNeeded(e->document()); -#endif assertNoSiblingRulesInDefaultStyle(); } @@ -1441,6 +1422,17 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } #endif +#if ENABLE(FULLSCREEN_API) + static bool loadedFullScreenStyleSheet; + if (!loadedFullScreenStyleSheet && e->document()->webkitIsFullScreen()) { + loadedFullScreenStyleSheet = true; + String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraFullScreenStyleSheet(); + CSSStyleSheet* fullscreenSheet = parseUASheet(fullscreenRules); + defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval()); + defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval()); + } +#endif + int firstUARule = -1, lastUARule = -1; int firstUserRule = -1, lastUserRule = -1; int firstAuthorRule = -1, lastAuthorRule = -1; @@ -1932,8 +1924,8 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parent // After performing the display mutation, check table rows. We do not honor position:relative on // table rows or cells. This has been established in CSS2.1 (and caused a crash in containingBlock() // on some sites). - if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP || - style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_CELL) && + if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP + || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW) && style->position() == RelativePosition) style->setPosition(StaticPosition); @@ -1976,9 +1968,9 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parent } // Finally update our text decorations in effect, but don't allow text-decoration to percolate through - // tables, inline blocks, inline tables, or run-ins. + // tables, inline blocks, inline tables, run-ins, or shadow DOM. if (style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN - || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX) + || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || (e && e->isShadowRoot())) style->setTextDecorationsInEffect(style->textDecoration()); else style->addToTextDecorationsInEffect(style->textDecoration()); @@ -2267,7 +2259,7 @@ CSSStyleSelector::SelectorMatch CSSStyleSelector::SelectorChecker::checkSelector #endif // first selector has to match - if (!checkOneSelector(sel, e, selectorAttrs, dynamicPseudo, isSubSelector, elementStyle, elementParentStyle)) + if (!checkOneSelector(sel, e, selectorAttrs, dynamicPseudo, isSubSelector, encounteredLink, elementStyle, elementParentStyle)) return SelectorFailsLocally; // The rest of the selectors has to match @@ -2437,7 +2429,7 @@ static bool htmlAttributeHasCaseInsensitiveValue(const QualifiedName& attr) return isPossibleHTMLAttr && htmlCaseInsensitiveAttributesSet->contains(attr.localName().impl()); } -bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isSubSelector, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const +bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isSubSelector, bool encounteredLink, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const { ASSERT(e); if (!e) @@ -2526,14 +2518,14 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme if (sel->m_match == CSSSelector::PseudoClass) { // Handle :not up front. if (sel->pseudoType() == CSSSelector::PseudoNot) { - // check the simple selector - for (CSSSelector* subSel = sel->simpleSelector(); subSel; subSel = subSel->tagHistory()) { + ASSERT(sel->selectorList()); + for (CSSSelector* subSel = sel->selectorList()->first(); subSel; subSel = subSel->tagHistory()) { // :not cannot nest. I don't really know why this is a // restriction in CSS3, but it is, so let's honor it. // the parser enforces that this never occurs - ASSERT(!subSel->simpleSelector()); + ASSERT(subSel->pseudoType() != CSSSelector::PseudoNot); - if (!checkOneSelector(subSel, e, selectorAttrs, dynamicPseudo, true, elementStyle, elementParentStyle)) + if (!checkOneSelector(subSel, e, selectorAttrs, dynamicPseudo, true, encounteredLink, elementStyle, elementParentStyle)) return true; } } else if (dynamicPseudo != NOPSEUDO && (RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER)) { @@ -2840,6 +2832,12 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme if (e == e->document()->cssTarget()) return true; break; + case CSSSelector::PseudoAny: + for (CSSSelector* selector = sel->selectorList()->first(); selector; selector = CSSSelectorList::next(selector)) { + if (checkSelector(selector, e, selectorAttrs, dynamicPseudo, true, encounteredLink, elementStyle, elementParentStyle) == SelectorMatches) + return true; + } + break; case CSSSelector::PseudoAnyLink: if (e && e->isLink()) return true; @@ -2847,7 +2845,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoAutofill: { if (!e || !e->isFormControlElement()) break; - if (InputElement* inputElement = toInputElement(e)) + if (InputElement* inputElement = e->toInputElement()) return inputElement->isAutofilled(); break; } @@ -2940,7 +2938,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that // you can't be both checked and indeterminate. We will behave like WinIE behind the scenes and just // obey the CSS spec here in the test for matching the pseudo. - InputElement* inputElement = toInputElement(e); + InputElement* inputElement = e->toInputElement(); if (inputElement && inputElement->isChecked() && !inputElement->isIndeterminate()) return true; break; @@ -2948,7 +2946,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoIndeterminate: { if (!e || !e->isFormControlElement()) break; - InputElement* inputElement = toInputElement(e); + InputElement* inputElement = e->toInputElement(); if (inputElement && inputElement->isIndeterminate()) return true; break; @@ -3313,9 +3311,14 @@ static void collectFeaturesFromList(CSSStyleSelector::Features& features, const bool foundSiblingSelector = false; for (CSSSelector* selector = ruleData.selector(); selector; selector = selector->tagHistory()) { collectFeaturesFromSelector(features, selector); - if (CSSSelector* simpleSelector = selector->simpleSelector()) - collectFeaturesFromSelector(features, simpleSelector); - if (selector->isSiblingSelector()) + + if (CSSSelectorList* selectorList = selector->selectorList()) { + for (CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = CSSSelectorList::next(subSelector)) { + if (selector->isSiblingSelector()) + foundSiblingSelector = true; + collectFeaturesFromSelector(features, subSelector); + } + } else if (selector->isSiblingSelector()) foundSiblingSelector = true; } if (foundSiblingSelector) { @@ -3363,7 +3366,7 @@ void RuleSet::shrinkToFit() // ------------------------------------------------------------------------------------- // this is mostly boring stuff on how to apply a certain rule to the renderstyle... -static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0) +static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, bool toFloat, double multiplier = 1, bool *ok = 0) { // This function is tolerant of a null style value. The only place style is used is in // length measurements, like 'ems' and 'px'. And in those cases style is only used @@ -3378,8 +3381,12 @@ static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* st if (!style && (type == CSSPrimitiveValue::CSS_EMS || type == CSSPrimitiveValue::CSS_EXS || type == CSSPrimitiveValue::CSS_REMS)) { if (ok) *ok = false; - } else if (CSSPrimitiveValue::isUnitTypeLength(type)) - l = Length(primitiveValue->computeLengthIntForLength(style, rootStyle, multiplier), Fixed); + } else if (CSSPrimitiveValue::isUnitTypeLength(type)) { + if (toFloat) + l = Length(primitiveValue->computeLengthDouble(style, rootStyle, multiplier), Fixed); + else + l = Length(primitiveValue->computeLengthIntForLength(style, rootStyle, multiplier), Fixed); + } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) l = Length(primitiveValue->getDoubleValue(), Percent); else if (type == CSSPrimitiveValue::CSS_NUMBER) @@ -3389,6 +3396,16 @@ static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* st } return l; } + +static Length convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0) +{ + return convertToLength(primitiveValue, style, rootStyle, false, multiplier, ok); +} + +static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1, bool *ok = 0) +{ + return convertToLength(primitiveValue, style, rootStyle, true, multiplier, ok); +} template <bool applyFirst> void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int endIndex) @@ -3406,7 +3423,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e if (applyFirst) { COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); - COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 13, CSS_zoom_is_end_of_first_prop_range); + COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 14, CSS_zoom_is_end_of_first_prop_range); COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom); // give special priority to font-xxx, color properties, etc @@ -3612,10 +3629,22 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } + CSSPropertyID property = static_cast<CSSPropertyID>(id); + + // check lookup table for implementations and use when available + if (m_applyProperty.implements(property)) { + if (isInherit) + m_applyProperty.inherit(property, this); + else if (isInitial) + m_applyProperty.initial(property, this); + else + m_applyProperty.value(property, this, value); + return; + } + // What follows is a list that maps the CSS properties into their corresponding front-end // RenderStyle values. Shorthands (e.g. border, background) occur in this list as well and // are only hit when mapping "inherit" or "initial" into front-end values. - CSSPropertyID property = static_cast<CSSPropertyID>(id); switch (property) { // ident only properties case CSSPropertyBackgroundAttachment: @@ -4020,87 +4049,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setCursor(*primitiveValue); } return; -// colors || inherit - case CSSPropertyColor: - // If the 'currentColor' keyword is set on the 'color' property itself, - // it is treated as 'color:inherit' at parse time - if (primitiveValue && primitiveValue->getIdent() == CSSValueCurrentcolor) - isInherit = true; - case CSSPropertyBackgroundColor: - case CSSPropertyBorderTopColor: - case CSSPropertyBorderRightColor: - case CSSPropertyBorderBottomColor: - case CSSPropertyBorderLeftColor: - case CSSPropertyOutlineColor: - case CSSPropertyWebkitColumnRuleColor: - case CSSPropertyWebkitTextStrokeColor: - case CSSPropertyWebkitTextEmphasisColor: - case CSSPropertyWebkitTextFillColor: { - Color col; - if (isInherit) { - HANDLE_INHERIT_COND(CSSPropertyBackgroundColor, backgroundColor, BackgroundColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyBorderTopColor, borderTopColor, color, BorderTopColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyBorderBottomColor, borderBottomColor, color, BorderBottomColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyBorderRightColor, borderRightColor, color, BorderRightColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyBorderLeftColor, borderLeftColor, color, BorderLeftColor) - HANDLE_INHERIT_COND(CSSPropertyColor, color, Color) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyOutlineColor, outlineColor, color, OutlineColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitColumnRuleColor, columnRuleColor, color, ColumnRuleColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextStrokeColor, textStrokeColor, color, TextStrokeColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextEmphasisColor, textEmphasisColor, color, TextEmphasisColor) - HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextFillColor, textFillColor, color, TextFillColor) - return; - } - if (isInitial) { - // The border/outline colors will just map to the invalid color |col| above. This will have the - // effect of forcing the use of the currentColor when it comes time to draw the borders (and of - // not painting the background since the color won't be valid). - if (id == CSSPropertyColor) - col = RenderStyle::initialColor(); - } else { - if (!primitiveValue) - return; - col = getColorFromPrimitiveValue(primitiveValue); - } - - switch (id) { - case CSSPropertyBackgroundColor: - m_style->setBackgroundColor(col); - break; - case CSSPropertyBorderTopColor: - m_style->setBorderTopColor(col); - break; - case CSSPropertyBorderRightColor: - m_style->setBorderRightColor(col); - break; - case CSSPropertyBorderBottomColor: - m_style->setBorderBottomColor(col); - break; - case CSSPropertyBorderLeftColor: - m_style->setBorderLeftColor(col); - break; - case CSSPropertyColor: - m_style->setColor(col); - break; - case CSSPropertyOutlineColor: - m_style->setOutlineColor(col); - break; - case CSSPropertyWebkitColumnRuleColor: - m_style->setColumnRuleColor(col); - break; - case CSSPropertyWebkitTextStrokeColor: - m_style->setTextStrokeColor(col); - break; - case CSSPropertyWebkitTextEmphasisColor: - m_style->setTextEmphasisColor(col); - break; - case CSSPropertyWebkitTextFillColor: - m_style->setTextFillColor(col); - break; - } - - return; - } // uri || inherit case CSSPropertyBackgroundImage: @@ -4672,13 +4620,16 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) HANDLE_INHERIT_AND_INITIAL(textAlign, TextAlign) if (!primitiveValue) return; - int id = primitiveValue->getIdent(); - if (id == CSSValueStart) - m_style->setTextAlign(m_style->isLeftToRightDirection() ? LEFT : RIGHT); - else if (id == CSSValueEnd) - m_style->setTextAlign(m_style->isLeftToRightDirection() ? RIGHT : LEFT); - else - m_style->setTextAlign(*primitiveValue); + if (primitiveValue->getIdent() == CSSValueWebkitMatchParent) { + if (m_parentStyle->textAlign() == TASTART) + m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? LEFT : RIGHT); + else if (m_parentStyle->textAlign() == TAEND) + m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? RIGHT : LEFT); + else + m_style->setTextAlign(m_parentStyle->textAlign()); + return; + } + m_style->setTextAlign(*primitiveValue); return; } @@ -4709,10 +4660,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) Rect* rect = primitiveValue->getRectValue(); if (!rect) return; - top = convertToLength(rect->top(), style(), m_rootElementStyle, zoomFactor); - right = convertToLength(rect->right(), style(), m_rootElementStyle, zoomFactor); - bottom = convertToLength(rect->bottom(), style(), m_rootElementStyle, zoomFactor); - left = convertToLength(rect->left(), style(), m_rootElementStyle, zoomFactor); + top = convertToIntLength(rect->top(), style(), m_rootElementStyle, zoomFactor); + right = convertToIntLength(rect->right(), style(), m_rootElementStyle, zoomFactor); + bottom = convertToIntLength(rect->bottom(), style(), m_rootElementStyle, zoomFactor); + left = convertToIntLength(rect->left(), style(), m_rootElementStyle, zoomFactor); } else if (primitiveValue->getIdent() != CSSValueAuto) { return; } @@ -5318,8 +5269,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) radiusHeight = Length(pair->second()->getDoubleValue(), Percent); else radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed); - int width = radiusWidth.rawValue(); - int height = radiusHeight.rawValue(); + int width = radiusWidth.value(); + int height = radiusHeight.value(); if (width < 0 || height < 0) return; if (width == 0) @@ -5655,9 +5606,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } else { bool ok = true; - Length l = convertToLength(primitiveValue, style(), m_rootElementStyle, 1, &ok); + Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle, 1, &ok); if (ok) - m_style->setMarqueeIncrement(l); + m_style->setMarqueeIncrement(marqueeLength); } return; } @@ -5819,10 +5770,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) DashboardRegion *first = region; while (region) { - Length top = convertToLength(region->top(), style(), m_rootElementStyle); - Length right = convertToLength(region->right(), style(), m_rootElementStyle); - Length bottom = convertToLength(region->bottom(), style(), m_rootElementStyle); - Length left = convertToLength(region->left(), style(), m_rootElementStyle); + Length top = convertToIntLength(region->top(), style(), m_rootElementStyle); + Length right = convertToIntLength(region->right(), style(), m_rootElementStyle); + Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle); + Length left = convertToIntLength(region->left(), style(), m_rootElementStyle); if (region->m_isCircle) m_style->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true); else if (region->m_isRectangle) @@ -6153,8 +6104,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitTextCombine: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textCombine, TextCombine) - if (m_style->hasTextCombine()) - m_style->setUnique(); // The style could be modified in RenderCombineText depending on text metrics. return; case CSSPropertyWebkitTextEmphasisPosition: @@ -6174,8 +6123,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (list->length() != 2) return; for (unsigned i = 0; i < 2; ++i) { - ASSERT(list->itemWithoutBoundsCheck(i)->isPrimitiveValue()); - CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(i)); + CSSValue* item = list->itemWithoutBoundsCheck(i); + if (!item->isPrimitiveValue()) + continue; + + CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item); if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen) m_style->setTextEmphasisFill(*value); else @@ -6207,6 +6159,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; +<<<<<<< HEAD #ifdef ANDROID_CSS_RING case CSSPropertyWebkitRing: if (valueType != CSSValue::CSS_INHERIT || !m_parentNode) return; @@ -6350,11 +6303,64 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } #endif +======= + case CSSPropertyWebkitTextOrientation: { + if (!isInherit && !isInitial && !primitiveValue) + return; + + TextOrientation result; + if (isInherit) + result = m_parentStyle->fontDescription().textOrientation(); + else if (isInitial) + result = RenderStyle::initialTextOrientation(); + else + result = *primitiveValue; + + FontDescription fontDescription = m_style->fontDescription(); + if (fontDescription.textOrientation() != result) { + fontDescription.setTextOrientation(result); + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + } + return; + } + + case CSSPropertyWebkitLineBoxContain: { + HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain) + if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) { + m_style->setLineBoxContain(LineBoxContainNone); + return; + } + + if (!value->isCSSLineBoxContainValue()) + return; + + CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value); + m_style->setLineBoxContain(lineBoxContainValue->value()); + return; + } + + // These properties are implemented in the CSSStyleApplyProperty lookup table. + case CSSPropertyColor: + case CSSPropertyBackgroundColor: + case CSSPropertyBorderBottomColor: + case CSSPropertyBorderLeftColor: + case CSSPropertyBorderRightColor: + case CSSPropertyBorderTopColor: + case CSSPropertyOutlineColor: + case CSSPropertyWebkitColumnRuleColor: + case CSSPropertyWebkitTextEmphasisColor: + case CSSPropertyWebkitTextFillColor: + case CSSPropertyWebkitTextStrokeColor: + ASSERT_NOT_REACHED(); + return; +>>>>>>> webkit.org at r82507 #if ENABLE(SVG) default: // Try the SVG properties applySVGProperty(id, value); + return; #endif } } @@ -7424,13 +7430,13 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* Length tx = Length(0, Fixed); Length ty = Length(0, Fixed); if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) - ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); else { - tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); - ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok); + ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor, &ok); } } } @@ -7448,19 +7454,19 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* Length ty = Length(0, Fixed); Length tz = Length(0, Fixed); if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation) - tz = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation) - ty = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); else { - tx = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { if (transformValue->length() > 2) { CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2)); - tz = convertToLength(thirdValue, style, rootStyle, zoomFactor, &ok); + tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor, &ok); } if (transformValue->length() > 1) { CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1)); - ty = convertToLength(secondValue, style, rootStyle, zoomFactor, &ok); + ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor, &ok); } } } @@ -7591,7 +7597,7 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* bool ok = true; Length p = Length(0, Fixed); if (CSSPrimitiveValue::isUnitTypeLength(firstValue->primitiveType())) - p = convertToLength(firstValue, style, rootStyle, zoomFactor, &ok); + p = convertToFloatLength(firstValue, style, rootStyle, zoomFactor, &ok); else { // This is a quirk that should go away when 3d transforms are finalized. double val = firstValue->getDoubleValue(); diff --git a/Source/WebCore/css/CSSStyleSelector.h b/Source/WebCore/css/CSSStyleSelector.h index 9f83f82..756c5bf 100644 --- a/Source/WebCore/css/CSSStyleSelector.h +++ b/Source/WebCore/css/CSSStyleSelector.h @@ -45,6 +45,7 @@ class CSSFontFaceRule; class CSSImageValue; class CSSRuleList; class CSSSelector; +class CSSStyleApplyProperty; class CSSStyleRule; class CSSStyleSheet; class CSSValue; @@ -95,6 +96,7 @@ public: void pushParent(Element* parent); void popParent(Element* parent); + PassRefPtr<RenderStyle> styleForElement(Element* e, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false, bool matchVisitedPseudoClass = false); void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list); @@ -111,6 +113,9 @@ public: PassRefPtr<RenderStyle> pseudoStyleForDataGridColumnHeader(DataGridColumn*, RenderStyle* parentStyle); #endif + RenderStyle* style() const { return m_style.get(); } + RenderStyle* parentStyle() const { return m_parentStyle; } + private: void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); void initElement(Element*); @@ -123,8 +128,6 @@ public: void pushParentStackFrame(Element* parent); void popParentStackFrame(); - RenderStyle* style() const { return m_style.get(); } - PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeValue&); public: @@ -156,7 +159,6 @@ public: private: void setFontSize(FontDescription&, float size); static float getComputedSizeFromSpecifiedSize(Document*, RenderStyle*, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules); - public: Color getColorFromPrimitiveValue(CSSPrimitiveValue*) const; @@ -256,7 +258,7 @@ public: bool checkSelector(CSSSelector*, Element*) const; SelectorMatch checkSelector(CSSSelector*, Element*, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isSubSelector, bool encounteredLink, RenderStyle* = 0, RenderStyle* elementParentStyle = 0) const; - bool checkOneSelector(CSSSelector*, Element*, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isSubSelector, RenderStyle*, RenderStyle* elementParentStyle) const; + bool checkOneSelector(CSSSelector*, Element*, HashSet<AtomicStringImpl*>* selectorAttrs, PseudoId& dynamicPseudo, bool isSubSelector, bool encounteredLink, RenderStyle*, RenderStyle* elementParentStyle) const; bool checkScrollbarPseudoClass(CSSSelector*, PseudoId& dynamicPseudo) const; static bool fastCheckSelector(const CSSSelector*, const Element*); @@ -355,6 +357,8 @@ public: HashSet<AtomicStringImpl*> m_selectorAttrs; Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls; Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults; + + const CSSStyleApplyProperty& m_applyProperty; }; } // namespace WebCore diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h index a101c66..de46ff9 100644 --- a/Source/WebCore/css/CSSValue.h +++ b/Source/WebCore/css/CSSValue.h @@ -65,7 +65,8 @@ public: virtual bool isTimingFunctionValue() const { return false; } virtual bool isValueList() const { return false; } virtual bool isWebKitCSSTransformValue() const { return false; } - + virtual bool isCSSLineBoxContainValue() const { return false; } + #if ENABLE(SVG) virtual bool isSVGColor() const { return false; } virtual bool isSVGPaint() const { return false; } diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 4fce4f3..6dac06f 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -4,7 +4,7 @@ # -------- # # The Values are sorted according to the properties they belong to, -# and have to be in the same order as the enums in RenderStyle.h. +# and have to be in the same order as the enums in RenderStyleConstants.h. # # If not, the optimizations in the cssparser and style selector will fail, # and produce incorrect results. @@ -212,6 +212,7 @@ justify -webkit-left -webkit-right -webkit-center +-webkit-match-parent # # CSS_PROP_LIST_STYLE_POSITION: # @@ -406,6 +407,7 @@ hand hide higher invert +-webkit-isolate landscape ledger legal @@ -790,3 +792,15 @@ farthest-side farthest-corner # contain # cover + +# -webkit-text-orientation +upright +vertical-right + +# -webkit-line-box-contain +font +glyphs +inline-box +replaced + + diff --git a/Source/WebCore/css/MediaQueryListListener.cpp b/Source/WebCore/css/MediaQueryListListener.cpp index ab73b1d..7512161 100644 --- a/Source/WebCore/css/MediaQueryListListener.cpp +++ b/Source/WebCore/css/MediaQueryListListener.cpp @@ -37,6 +37,11 @@ void MediaQueryListListener::queryChanged(ScriptState* state, MediaQueryList* qu #if USE(JSC) callback.appendArgument(toJS(state, query)); #else + v8::HandleScope handleScope; + v8::Handle<v8::Context> context = state->context(); + if (context.IsEmpty()) + return; // JS may not be enabled. + v8::Context::Scope scope(context); callback.appendArgument(toV8(query)); #endif callback.call(); diff --git a/Source/WebCore/css/StyleSheetList.h b/Source/WebCore/css/StyleSheetList.h index a486511..a019691 100644 --- a/Source/WebCore/css/StyleSheetList.h +++ b/Source/WebCore/css/StyleSheetList.h @@ -50,6 +50,11 @@ public: { m_sheets.swap(sheets); } + + Document* document() + { + return m_doc; + } private: StyleSheetList(Document*); diff --git a/Source/WebCore/css/fullscreenQuickTime.css b/Source/WebCore/css/fullscreenQuickTime.css new file mode 100644 index 0000000..80cf9e4 --- /dev/null +++ b/Source/WebCore/css/fullscreenQuickTime.css @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* alternate media controls - Extend fullscreen.css */ + +video:-webkit-full-screen::-webkit-media-controls-panel { + -webkit-box-align: start; + -webkit-box-pack: end; + -webkit-appearance: none; + + bottom: 50px; + left: 50%; + margin-left: -220px; + padding: 12px 0 0 10px; + width: 430px; + height: 48px; + + background-image: -webkit-gradient( + linear, + left top, + left bottom, + color-stop(0, rgba(30, 30, 30, .97)), + color-stop(0.333, rgba(45, 45, 45, .97)), + color-stop(0.35, rgba(25, 25, 25, .97)), + color-stop(0.366, rgba(25, 25, 25, .97)), + color-stop(0.366, rgba(12, 12, 12, .97)), + color-stop(1, rgba(19, 19, 19, .97)) + ); + + -webkit-box-shadow: + inset 0 -1px 1px rgba(0, 0, 0, 0.5), + inset 0 1px 0 0px rgba(255, 255, 255, 0.15), + inset 0 -1px 0 0px rgba(202, 202, 202, 0.09), + 0 0 0 1px rgba(0, 0, 0, 0.5); + -webkit-border-radius: 8px; +} + +video:-webkit-full-screen::-webkit-media-controls-mute-button { + display: none; +} + +video:-webkit-full-screen::-webkit-media-controls-volume-slider-container { + display: none; +} + +video:-webkit-full-screen::-webkit-media-controls-volume-slider { + display: none; +} + +video:-webkit-full-screen::-webkit-media-controls-volume-slider-mute-button { + display: none; +} + +video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-min-button { + -webkit-appearance: media-mute-button; + display: block; + position: absolute; + left: 11px; + top: 15px; + width: 14px; + height: 12px; +} + +video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-slider { + -webkit-appearance: media-slider; + display: block; + position: absolute; + left: 28px; + top: 15px; + height: 12px; + width: 50px; +} + +video:-webkit-full-screen::-webkit-media-controls-fullscreen-volume-max-button { + -webkit-appearance: media-mute-button; + display: block; + position: absolute; + left: 84px; + top: 15px; + width: 14px; + height: 12px; +} + +video:-webkit-full-screen::-webkit-media-controls-play-button { + position: absolute; + width: 22px; + height: 23px; + left: 209px; + top: 9px; +} + +video:-webkit-full-screen::-webkit-media-controls-rewind-button { + position: absolute; + left: 162px; + top: 13px; + width: 18px; + height: 18px; +} + +video:-webkit-full-screen::-webkit-media-controls-seek-back-button { + position: absolute; + display: -webkit-box; + width: 23px; + height: 16px; + left: 162px; + top: 13px; +} + +video:-webkit-full-screen::-webkit-media-controls-seek-forward-button { + position: absolute; + display: -webkit-box; + width: 23px; + height: 16px; + left: 262px; + top: 13px; +} + +video:-webkit-full-screen::-webkit-media-controls-timeline-container { + height: auto; + width: 420px; + position: absolute; + bottom: 9px; + left: 8px; + right: 8px; +} + +video:-webkit-full-screen::video::-webkit-media-controls-status-display { + width: 420px; + position: absolute; + bottom: 9px; + left: 8px; + right: 8px; +} diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 61178d0..bd3bde0 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -152,6 +152,36 @@ h1 { font-weight: bold } +:-webkit-any(article,aside,nav,section) h1 { + font-size: 1.5em; + -webkit-margin-before: 0.83__qem; + -webkit-margin-after: 0.83em; +} + +:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { + font-size: 1.17em; + -webkit-margin-before: 1__qem; + -webkit-margin-after: 1em; +} + +:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { + font-size: 1.00em; + -webkit-margin-before: 1.33__qem; + -webkit-margin-after: 1.33em; +} + +:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { + font-size: .83em; + -webkit-margin-before: 1.67__qem; + -webkit-margin-after: 1.67em; +} + +:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { + font-size: .67em; + -webkit-margin-before: 2.33__qem; + -webkit-margin-after: 2.33em; +} + h2 { display: block; font-size: 1.5em; @@ -476,6 +506,7 @@ input[type="file"] { input:-webkit-autofill { background-color: #FAFFBD !important; background-image:none !important; + color: #000000 !important; } input[type="radio"], input[type="checkbox"] { @@ -587,55 +618,55 @@ output { /* form validation message bubble */ ::-webkit-validation-bubble { - display: block; + display: inline-block; z-index: 2147483647; position: absolute; - opacity: 0.9; + opacity: 0.95; line-height: 0; + margin: 0; -webkit-text-security: none; -webkit-transition: opacity 05.5s ease; } ::-webkit-validation-bubble-message { display: block; + position: relative; + top: -4px; font: message-box; + color: black; min-width: 50px; max-width: 200px; - border: solid 2px black; - background: -webkit-gradient(linear, left top, left bottom, from(#fbf9f9), to(#f0e4e4)); + border: solid 2px #400; + background: -webkit-gradient(linear, left top, left bottom, from(#f8ecec), to(#e8cccc)); padding: 8px; -webkit-border-radius: 8px; - -webkit-box-shadow: 4px 4px 4px rgba(204,204,204,0.7); + -webkit-box-shadow: 4px 4px 4px rgba(100,100,100,0.6), + inset -2px -2px 1px #d0c4c4, + inset 2px 2px 1px white; line-height: normal; + z-index: 2147483644; } -::-webkit-validation-bubble-top-outer-arrow { +::-webkit-validation-bubble-arrow { display: inline-block; position: relative; - left: 14px; - height: 0; - width: 0; + left: 32px; + width: 16px; + height: 16px; + background-color: #f8ecec; + border-width: 2px 0 0 2px; border-style: solid; - border-width: 14px; - border-bottom-color: black; - border-right-color: transparent; - border-top-width: 0; - border-left-width: 0; + border-color: #400; + box-shadow: inset 2px 2px 1px white; + -webkit-transform-origin: 0 0; + -webkit-transform: rotate(45deg); + z-index: 2147483645; } -::-webkit-validation-bubble-top-inner-arrow { - display: inline-block; - height: 0; - width: 0; - border-style: solid; - border-width: 10px; /* <border box width of outer-arrow> - <message border width> * 2 */ - border-bottom-color: #fbf9f9; - border-right-color: transparent; - border-top-width: 0; - border-left-width: 0; - position: relative; - top: 2px; /* <message border width> */ - left: 2px; /* <outer-arrow position> + <message border width> - <border box width of outer-arrow> */ +::-webkit-validation-bubble-arrow-clipper { + display: block; + overflow: hidden; + height: 16px; } /* meter */ diff --git a/Source/WebCore/css/mediaControls.css b/Source/WebCore/css/mediaControls.css index 88144b4..874cb13 100644 --- a/Source/WebCore/css/mediaControls.css +++ b/Source/WebCore/css/mediaControls.css @@ -171,3 +171,15 @@ audio::-webkit-media-controls-volume-slider-mute-button, video::-webkit-media-co border: initial; color: inherit; } + +audio::-webkit-media-controls-fullscreen-volume-slider, video::-webkit-media-controls-fullscreen-volume-slider { + display: none; +} + +audio::-webkit-media-controls-fullscreen-volume-min-button, video::-webkit-media-controls-fullscreen-volume-min-button { + display: none; +} + +audio::-webkit-media-controls-fullscreen-volume-max-button, video::-webkit-media-controls-fullscreen-volume-max-button { + display: none; +} diff --git a/Source/WebCore/css/mediaControlsEfl.css b/Source/WebCore/css/mediaControlsEfl.css new file mode 100644 index 0000000..938d7e8 --- /dev/null +++ b/Source/WebCore/css/mediaControlsEfl.css @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2011 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* EFLWebKit media controls. Extends mediaControls.css */ + +audio { + width: 200px; + height: 25px; +} + +audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: center; + -webkit-user-select: none; + position: absolute; + bottom: 0; + width: 100%; + z-index: 0; + overflow: hidden; + height: 25px; + text-align: right; +} + +video:-webkit-full-page-media::-webkit-media-controls-panel { + bottom: -25px; +} + +audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { + -webkit-appearance: media-mute-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { + -webkit-appearance: media-play-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container { + -webkit-appearance: media-controls-background; + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: center; + -webkit-box-pack: end; + -webkit-box-flex: 1; + -webkit-user-select: none; + height: 25px; +} + +audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display { + display: none; +} + +audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { + display: none; +} + +audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { + -webkit-appearance: media-slider; + display: -webkit-box; + -webkit-box-flex: 1; + height: 25px; + padding: 0px 2px; + background-color: initial; + border: initial; + color: inherit; + margin: initial; +} + +audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { + display: none; +} + +audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider { + display: none; + background-color: initial; + border: initial; + color: inherit; + margin: initial; +} + +audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { + -webkit-appearance: media-seek-back-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button { + -webkit-appearance: media-seek-forward-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { + -webkit-appearance: media-fullscreen-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { + display: none; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { + display: none; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { + -webkit-appearance: media-toggle-closed-captions-button; + display: -webkit-box; + width: 25px; + height: 25px; + background-color: initial; + border: initial; + color: inherit; +} + +audio::-webkit-media-controls-volume-slider-mute-button, video::-webkit-media-controls-volume-slider-mute-button { + -webkit-appearance: media-volume-slider-mute-button; + display: none; + background-color: initial; + border: initial; + color: inherit; +} diff --git a/Source/WebCore/css/themeChromiumLinux.css b/Source/WebCore/css/themeChromiumLinux.css index cb7e900..a6a8828 100644 --- a/Source/WebCore/css/themeChromiumLinux.css +++ b/Source/WebCore/css/themeChromiumLinux.css @@ -34,6 +34,7 @@ select { background-color: #dddddd; } +select:not([size]):not([multiple]) option, select[size="0"] option, select[size="1"] option { background-color: #f7f7f7; diff --git a/Source/WebCore/css/tokenizer.flex b/Source/WebCore/css/tokenizer.flex index eb18cb9..88a92a2 100644 --- a/Source/WebCore/css/tokenizer.flex +++ b/Source/WebCore/css/tokenizer.flex @@ -102,13 +102,18 @@ nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})? {num}Hz {yyTok = HERTZ; return yyTok;} {num}kHz {yyTok = KHERTZ; return yyTok;} {num}{ident} {yyTok = DIMEN; return yyTok;} +{num}{ident}\+ {yyTok = INVALIDDIMEN; return yyTok;} {num}%+ {yyTok = PERCENTAGE; return yyTok;} {intnum} {yyTok = INTEGER; return yyTok;} {num} {yyTok = FLOATTOKEN; return yyTok;} +"-webkit-any(" {yyTok = ANYFUNCTION; return yyTok;} "not(" {yyTok = NOTFUNCTION; return yyTok;} "url("{w}{string}{w}")" {yyTok = URI; return yyTok;} "url("{w}{url}{w}")" {yyTok = URI; return yyTok;} +"-webkit-calc(" {yyTok = CALCFUNCTION; return yyTok;} +"-webkit-min(" {yyTok = MINFUNCTION; return yyTok;} +"-webkit-max(" {yyTok = MAXFUNCTION; return yyTok;} {ident}"(" {yyTok = FUNCTION; return yyTok;} U\+{range} {yyTok = UNICODERANGE; return yyTok;} diff --git a/Source/WebCore/css/wml.css b/Source/WebCore/css/wml.css index 4bcf08f..38169fc 100644 --- a/Source/WebCore/css/wml.css +++ b/Source/WebCore/css/wml.css @@ -147,6 +147,7 @@ input[type="password"] { input:-webkit-autofill { background-color: #FAFFBD !important; background-image:none !important; + color: #000000 !important; } do:disabled, select:disabled, optgroup:disabled, option:disabled { |