From 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Thu, 2 Jun 2011 12:07:03 +0100 Subject: Merge WebKit at r84325: Initial merge by git. Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b --- Source/WebCore/css/CSSFontFaceSource.cpp | 6 +- Source/WebCore/css/CSSFontFaceSource.h | 2 + Source/WebCore/css/CSSFontSelector.cpp | 31 +- Source/WebCore/css/CSSFontSelector.h | 7 + Source/WebCore/css/CSSGrammar.y | 19 +- Source/WebCore/css/CSSMutableStyleDeclaration.cpp | 12 +- Source/WebCore/css/CSSMutableStyleDeclaration.h | 3 +- Source/WebCore/css/CSSParser.cpp | 165 ++++++++++- Source/WebCore/css/CSSParser.h | 6 +- Source/WebCore/css/CSSPrimitiveValueMappings.h | 1 + Source/WebCore/css/CSSSelector.cpp | 61 +--- Source/WebCore/css/CSSSelector.h | 8 - Source/WebCore/css/CSSStyleApplyProperty.cpp | 252 +++++++++++++++- Source/WebCore/css/CSSStyleApplyProperty.h | 28 +- Source/WebCore/css/CSSStyleDeclaration.cpp | 7 +- Source/WebCore/css/CSSStyleSelector.cpp | 342 +++++++--------------- Source/WebCore/css/CSSStyleSelector.h | 2 + Source/WebCore/css/WebKitCSSMatrix.cpp | 3 +- Source/WebCore/css/fullscreen.css | 11 +- Source/WebCore/css/html.css | 70 ++--- Source/WebCore/css/mediaControls.css | 16 +- Source/WebCore/css/mediaControlsEfl.css | 4 +- Source/WebCore/css/mediaControlsQt.css | 5 + Source/WebCore/css/mediaControlsQuickTime.css | 13 +- Source/WebCore/css/themeQtMobile.css | 134 --------- Source/WebCore/css/tokenizer.flex | 3 +- 26 files changed, 651 insertions(+), 560 deletions(-) delete mode 100644 Source/WebCore/css/themeQtMobile.css (limited to 'Source/WebCore/css') diff --git a/Source/WebCore/css/CSSFontFaceSource.cpp b/Source/WebCore/css/CSSFontFaceSource.cpp index d32684e..eeb90a4 100644 --- a/Source/WebCore/css/CSSFontFaceSource.cpp +++ b/Source/WebCore/css/CSSFontFaceSource.cpp @@ -51,7 +51,7 @@ CSSFontFaceSource::CSSFontFaceSource(const String& str, CachedFont* font) , m_font(font) , m_face(0) #if ENABLE(SVG_FONTS) - , m_svgFontFaceElement(0) + , m_hasExternalSVGFont(false) #endif { if (m_font) @@ -126,7 +126,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri if (isLoaded()) { if (m_font) { #if ENABLE(SVG_FONTS) - if (m_font->isSVGFont()) { + if (m_hasExternalSVGFont) { // For SVG fonts parse the external SVG document, and extract the element. if (!m_font->ensureSVGFontData()) return 0; @@ -204,7 +204,7 @@ void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr ele bool CSSFontFaceSource::isSVGFontFaceSource() const { - return m_svgFontFaceElement || (m_font && m_font->isSVGFont()); + return m_svgFontFaceElement || m_hasExternalSVGFont; } #endif diff --git a/Source/WebCore/css/CSSFontFaceSource.h b/Source/WebCore/css/CSSFontFaceSource.h index a5c3e61..e87fbfc 100644 --- a/Source/WebCore/css/CSSFontFaceSource.h +++ b/Source/WebCore/css/CSSFontFaceSource.h @@ -66,6 +66,7 @@ public: SVGFontFaceElement* svgFontFaceElement() const; void setSVGFontFaceElement(PassRefPtr); bool isSVGFontFaceSource() const; + void setHasExternalSVGFont(bool value) { m_hasExternalSVGFont = value; } #endif private: @@ -77,6 +78,7 @@ private: #if ENABLE(SVG_FONTS) RefPtr m_svgFontFaceElement; RefPtr m_externalSVGFontElement; + bool m_hasExternalSVGFont; #endif }; diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index 9c9a844..8024afa 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -247,11 +247,11 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule) if (allowDownloading && item->isSupportedFormat() && m_document) { CachedFont* cachedFont = m_document->cachedResourceLoader()->requestFont(item->resource()); if (cachedFont) { + source = new CSSFontFaceSource(item->resource(), cachedFont); #if ENABLE(SVG_FONTS) if (foundSVGFont) - cachedFont->setSVGFont(true); + source->setHasExternalSVGFont(true); #endif - source = new CSSFontFaceSource(item->resource(), cachedFont); } } } else { @@ -345,18 +345,37 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule) } } -void CSSFontSelector::fontLoaded() +void CSSFontSelector::registerForInvalidationCallbacks(FontSelectorClient* client) +{ + m_clients.add(client); +} + +void CSSFontSelector::unregisterForInvalidationCallbacks(FontSelectorClient* client) +{ + m_clients.remove(client); +} + +void CSSFontSelector::dispatchInvalidationCallbacks() { + Vector clients; + copyToVector(m_clients, clients); + for (size_t i = 0; i < clients.size(); ++i) + clients[i]->fontsNeedUpdate(this); + + // FIXME: Make Document a FontSelectorClient so that it can simply register for invalidation callbacks. if (!m_document || m_document->inPageCache() || !m_document->renderer()) return; m_document->scheduleForcedStyleRecalc(); } +void CSSFontSelector::fontLoaded() +{ + dispatchInvalidationCallbacks(); +} + void CSSFontSelector::fontCacheInvalidated() { - if (!m_document || m_document->inPageCache() || !m_document->renderer()) - return; - m_document->scheduleForcedStyleRecalc(); + dispatchInvalidationCallbacks(); } static FontData* fontDataForGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName) diff --git a/Source/WebCore/css/CSSFontSelector.h b/Source/WebCore/css/CSSFontSelector.h index 93ee274..f50ea42 100644 --- a/Source/WebCore/css/CSSFontSelector.h +++ b/Source/WebCore/css/CSSFontSelector.h @@ -29,6 +29,7 @@ #include "FontSelector.h" #include #include +#include #include #include @@ -62,13 +63,19 @@ public: CachedResourceLoader* cachedResourceLoader() const; + virtual void registerForInvalidationCallbacks(FontSelectorClient*); + virtual void unregisterForInvalidationCallbacks(FontSelectorClient*); + private: CSSFontSelector(Document*); + void dispatchInvalidationCallbacks(); + Document* m_document; HashMap >*, CaseFoldingHash> m_fontFaces; HashMap >*, CaseFoldingHash> m_locallyInstalledFontFaces; HashMap >*, CaseFoldingHash> m_fonts; + HashSet m_clients; }; } // namespace WebCore diff --git a/Source/WebCore/css/CSSGrammar.y b/Source/WebCore/css/CSSGrammar.y index 246a449..269eaf0 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 55 +%expect 54 %nonassoc LOWEST_PREC @@ -226,7 +226,6 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type string_or_uri %type ident_or_string %type medium -%type hexcolor %type margin_sym %type media_feature @@ -1414,7 +1413,7 @@ term: | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_URI; } | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } - | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } + | HEX maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */ | function { @@ -1520,7 +1519,8 @@ calc_func_paren_expr: $$->insertValueAt(0, v); v.iValue = ')'; $$->addValue(v); - } + } else + $$ = 0; } calc_func_expr: @@ -1619,17 +1619,6 @@ min_or_max_function: } ; -/* - * There is a constraint on the color that it must - * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) - * after the "#"; e.g., "#000" is OK, but "#abcd" is not. - */ -hexcolor: - HEX maybe_space { $$ = $1; } - | IDSEL maybe_space { $$ = $1; } - ; - - /* error handling rules */ save_block: diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp index 6485e5b..8c8d5ba 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -585,8 +585,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value // When replacing an existing property value, this moves the property to the end of the list. // Firefox preserves the position, and MSIE moves the property to the beginning. - CSSParser parser(useStrictParsing()); - bool success = parser.parseValue(this, propertyID, value, important); + bool success = CSSParser::parseValue(this, propertyID, value, important, useStrictParsing()); if (!success) { // CSS DOM requires raising SYNTAX_ERR here, but this is too dangerous for compatibility, // see . @@ -619,6 +618,15 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool imp return true; } +bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged) +{ + CSSProperty property(propertyID, CSSPrimitiveValue::create(value, unit), important); + setPropertyInternal(property); + if (notifyChanged) + setNeedsStyleRecalc(); + return true; +} + void CSSMutableStyleDeclaration::setStringProperty(int propertyId, const String &value, CSSPrimitiveValue::UnitTypes type, bool important) { ASSERT(!m_iteratorCount); diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/CSSMutableStyleDeclaration.h index ca17f11..ea8ab3f 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.h +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.h @@ -109,6 +109,7 @@ public: virtual PassRefPtr copy() const; bool setProperty(int propertyID, int value, bool important = false, bool notifyChanged = true); + bool setProperty(int propertyId, double value, CSSPrimitiveValue::UnitTypes, bool important = false, bool notifyChanged = true); bool setProperty(int propertyID, const String& value, bool important = false, bool notifyChanged = true); String removeProperty(int propertyID, bool notifyChanged = true, bool returnText = false); @@ -117,7 +118,7 @@ public: void setLengthProperty(int propertyId, const String& value, bool important, bool multiLength = false); void setStringProperty(int propertyId, const String& value, CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value void setImageProperty(int propertyId, const String& url, bool important = false); - + // The following parses an entire new style declaration. void parseDeclaration(const String& styleDeclaration); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index a941600..b7030b2 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -281,7 +281,164 @@ PassRefPtr CSSParser::parseKeyframeRule(CSSStyleSheet *sheet, const Str return m_keyframe.release(); } -bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, const String& string, bool important) +static inline bool isColorPropertyID(int propertyId) +{ + switch (propertyId) { + case CSSPropertyColor: + case CSSPropertyBackgroundColor: + case CSSPropertyBorderBottomColor: + case CSSPropertyBorderLeftColor: + case CSSPropertyBorderRightColor: + case CSSPropertyBorderTopColor: + case CSSPropertyOutlineColor: + case CSSPropertyTextLineThroughColor: + case CSSPropertyTextOverlineColor: + case CSSPropertyTextUnderlineColor: + case CSSPropertyWebkitBorderAfterColor: + case CSSPropertyWebkitBorderBeforeColor: + case CSSPropertyWebkitBorderEndColor: + case CSSPropertyWebkitBorderStartColor: + case CSSPropertyWebkitColumnRuleColor: + case CSSPropertyWebkitTextEmphasisColor: + case CSSPropertyWebkitTextFillColor: + case CSSPropertyWebkitTextStrokeColor: + return true; + default: + return false; + } +} + +static bool parseColorValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict) +{ + if (!string.length()) + return false; + if (!isColorPropertyID(propertyId)) + return false; + CSSParserString cssString; + cssString.characters = const_cast(string.characters()); + cssString.length = string.length(); + int valueID = cssValueKeywordID(cssString); + bool validPrimitive = false; + if (valueID == CSSValueWebkitText) + validPrimitive = true; + else if (valueID == CSSValueCurrentcolor) + validPrimitive = true; + else if ((valueID >= CSSValueAqua && valueID <= CSSValueWindowtext) || valueID == CSSValueMenu + || (valueID >= CSSValueWebkitFocusRingColor && valueID < CSSValueWebkitText && !strict)) { + validPrimitive = true; + } + + CSSStyleSheet* stylesheet = static_cast(declaration->stylesheet()); + if (!stylesheet || !stylesheet->document()) + return false; + if (validPrimitive) { + CSSProperty property(propertyId, stylesheet->document()->cssPrimitiveValueCache()->createIdentifierValue(valueID), important); + declaration->addParsedProperty(property); + return true; + } + RGBA32 color; + if (!CSSParser::parseColor(string, color, strict && string[0] != '#')) + return false; + CSSProperty property(propertyId, stylesheet->document()->cssPrimitiveValueCache()->createColorValue(color), important); + declaration->addParsedProperty(property); + return true; +} + +static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativeNumbers) +{ + switch (propertyId) { + case CSSPropertyFontSize: + case CSSPropertyHeight: + case CSSPropertyWidth: + case CSSPropertyMinHeight: + case CSSPropertyMinWidth: + case CSSPropertyPaddingBottom: + case CSSPropertyPaddingLeft: + case CSSPropertyPaddingRight: + case CSSPropertyPaddingTop: + case CSSPropertyWebkitLogicalWidth: + case CSSPropertyWebkitLogicalHeight: + case CSSPropertyWebkitMinLogicalWidth: + case CSSPropertyWebkitMinLogicalHeight: + case CSSPropertyWebkitPaddingAfter: + case CSSPropertyWebkitPaddingBefore: + case CSSPropertyWebkitPaddingEnd: + case CSSPropertyWebkitPaddingStart: + acceptsNegativeNumbers = false; + return true; + case CSSPropertyBottom: + case CSSPropertyLeft: + case CSSPropertyMarginBottom: + case CSSPropertyMarginLeft: + case CSSPropertyMarginRight: + case CSSPropertyMarginTop: + case CSSPropertyRight: + case CSSPropertyTextIndent: + case CSSPropertyTop: + case CSSPropertyWebkitMarginAfter: + case CSSPropertyWebkitMarginBefore: + case CSSPropertyWebkitMarginEnd: + case CSSPropertyWebkitMarginStart: + acceptsNegativeNumbers = true; + return true; + default: + return false; + } +} + +static bool parseSimpleLengthValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict) +{ + const UChar* characters = string.characters(); + unsigned length = string.length(); + if (!characters || !length) + return false; + bool acceptsNegativeNumbers; + if (!isSimpleLengthPropertyID(propertyId, acceptsNegativeNumbers)) + return false; + + CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER; + if (length > 2 && characters[length - 2] == 'p' && characters[length - 1] == 'x') { + length -= 2; + unit = CSSPrimitiveValue::CSS_PX; + } else if (length > 1 && characters[length - 1] == '%') { + length -= 1; + unit = CSSPrimitiveValue::CSS_PERCENTAGE; + } + + // We rely on charactersToDouble for validation as well. The function + // will set "ok" to "false" if the entire passed-in character range does + // not represent a double. + bool ok; + double number = charactersToDouble(characters, length, &ok); + if (!ok) + return false; + if (unit == CSSPrimitiveValue::CSS_NUMBER) { + if (number && strict) + return false; + unit = CSSPrimitiveValue::CSS_PX; + } + if (number < 0 && !acceptsNegativeNumbers) + return false; + + CSSStyleSheet* stylesheet = static_cast(declaration->stylesheet()); + if (!stylesheet || !stylesheet->document()) + return false; + CSSProperty property(propertyId, stylesheet->document()->cssPrimitiveValueCache()->createValue(number, unit), important); + declaration->addParsedProperty(property); + return true; +} + +bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict) +{ + if (parseSimpleLengthValue(declaration, propertyId, string, important, strict)) + return true; + if (parseColorValue(declaration, propertyId, string, important, strict)) + return true; + CSSParser parser(strict); + return parser.parseValue(declaration, propertyId, string, important); +} + +bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important) { #ifdef ANDROID_INSTRUMENT android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); @@ -291,7 +448,7 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, cons setupParser("@-webkit-value{", string, "} "); - m_id = id; + m_id = propertyId; m_important = important; cssyyparse(this); @@ -6086,13 +6243,13 @@ Vector >* CSSParser::createFloatingSelectorVector() return selectorVector; } -Vector >* CSSParser::sinkFloatingSelectorVector(Vector >* selectorVector) +PassOwnPtr > > CSSParser::sinkFloatingSelectorVector(Vector >* selectorVector) { if (selectorVector) { ASSERT(m_floatingSelectorVectors.contains(selectorVector)); m_floatingSelectorVectors.remove(selectorVector); } - return selectorVector; + return adoptPtr(selectorVector); } CSSParserValueList* CSSParser::createFloatingValueList() diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index c03afd9..4b1fad6 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -63,7 +63,7 @@ namespace WebCore { void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0); PassRefPtr parseRule(CSSStyleSheet*, const String&); PassRefPtr parseKeyframeRule(CSSStyleSheet*, const String&); - bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important); + static bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict); static bool parseColor(RGBA32& color, const String&, bool strict = false); static bool parseSystemColor(RGBA32& color, const String&, Document*); bool parseColor(CSSMutableStyleDeclaration*, const String&); @@ -186,7 +186,7 @@ namespace WebCore { PassOwnPtr sinkFloatingSelector(CSSParserSelector*); Vector >* createFloatingSelectorVector(); - Vector >* sinkFloatingSelectorVector(Vector >*); + PassOwnPtr > > sinkFloatingSelectorVector(Vector >*); CSSParserValueList* createFloatingValueList(); CSSParserValueList* sinkFloatingValueList(CSSParserValueList*); @@ -291,6 +291,8 @@ namespace WebCore { bool isGeneratedImageValue(CSSParserValue*) const; bool parseGeneratedImage(RefPtr&); + bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important); + enum SizeParameterType { None, Auto, diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index 16412ad..b1f9aec 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -42,6 +42,7 @@ #include "TextOrientation.h" #include "TextRenderingMode.h" #include "ThemeTypes.h" +#include "UnicodeBidi.h" namespace WebCore { diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp index a87d4f3..9cf8c99 100644 --- a/Source/WebCore/css/CSSSelector.cpp +++ b/Source/WebCore/css/CSSSelector.cpp @@ -160,36 +160,6 @@ PseudoId CSSSelector::pseudoId(PseudoType type) return INNER_SPIN_BUTTON; case PseudoOuterSpinButton: return OUTER_SPIN_BUTTON; -#if ENABLE(METER_TAG) - case PseudoMeterHorizontalBar: - return METER_HORIZONTAL_BAR; - case PseudoMeterHorizontalOptimum: - return METER_HORIZONTAL_OPTIMUM; - case PseudoMeterHorizontalSuboptimal: - return METER_HORIZONTAL_SUBOPTIMAL; - case PseudoMeterHorizontalEvenLessGood: - return METER_HORIZONTAL_EVEN_LESS_GOOD; - case PseudoMeterVerticalBar: - return METER_VERTICAL_BAR; - case PseudoMeterVerticalOptimum: - return METER_VERTICAL_OPTIMUM; - case PseudoMeterVerticalSuboptimal: - return METER_VERTICAL_SUBOPTIMAL; - case PseudoMeterVerticalEvenLessGood: - return METER_VERTICAL_EVEN_LESS_GOOD; -#else - case PseudoMeterHorizontalBar: - case PseudoMeterHorizontalOptimum: - case PseudoMeterHorizontalSuboptimal: - case PseudoMeterHorizontalEvenLessGood: - case PseudoMeterVerticalBar: - case PseudoMeterVerticalOptimum: - case PseudoMeterVerticalSuboptimal: - case PseudoMeterVerticalEvenLessGood: - ASSERT_NOT_REACHED(); - return NOPSEUDO; -#endif - #if ENABLE(FULLSCREEN_API) case PseudoFullScreen: return FULL_SCREEN; @@ -315,17 +285,6 @@ static HashMap* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button")); -#if ENABLE(METER_TAG) - DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalBar, ("-webkit-meter-horizontal-bar")); - DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalOptimumValue, ("-webkit-meter-horizontal-optimum-value")); - DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalSuboptimalValue, ("-webkit-meter-horizontal-suboptimal-value")); - DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalEvenLessGoodValue, ("-webkit-meter-horizontal-even-less-good-value")); - DEFINE_STATIC_LOCAL(AtomicString, meterVerticalBar, ("-webkit-meter-vertical-bar")); - DEFINE_STATIC_LOCAL(AtomicString, meterVerticalOptimumValue, ("-webkit-meter-vertical-optimum-value")); - DEFINE_STATIC_LOCAL(AtomicString, meterVerticalSuboptimalValue, ("-webkit-meter-vertical-suboptimal-value")); - DEFINE_STATIC_LOCAL(AtomicString, meterVerticalEvenLessGoodValue, ("-webkit-meter-vertical-even-less-good-value")); -#endif - DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); DEFINE_STATIC_LOCAL(AtomicString, root, ("root")); @@ -413,16 +372,6 @@ static HashMap* nameToPseudoTypeMap( nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChild); nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType); nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton); -#if ENABLE(METER_TAG) - nameToPseudoType->set(meterHorizontalBar.impl(), CSSSelector::PseudoMeterHorizontalBar); - nameToPseudoType->set(meterHorizontalOptimumValue.impl(), CSSSelector::PseudoMeterHorizontalOptimum); - nameToPseudoType->set(meterHorizontalSuboptimalValue.impl(), CSSSelector::PseudoMeterHorizontalSuboptimal); - nameToPseudoType->set(meterHorizontalEvenLessGoodValue.impl(), CSSSelector::PseudoMeterHorizontalEvenLessGood); - nameToPseudoType->set(meterVerticalBar.impl(), CSSSelector::PseudoMeterVerticalBar); - nameToPseudoType->set(meterVerticalOptimumValue.impl(), CSSSelector::PseudoMeterVerticalOptimum); - nameToPseudoType->set(meterVerticalSuboptimalValue.impl(), CSSSelector::PseudoMeterVerticalSuboptimal); - nameToPseudoType->set(meterVerticalEvenLessGoodValue.impl(), CSSSelector::PseudoMeterVerticalEvenLessGood); -#endif nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); nameToPseudoType->set(decrement.impl(), CSSSelector::PseudoDecrement); @@ -497,15 +446,7 @@ void CSSSelector::extractPseudoType() const case PseudoInputSpeechButton: #endif case PseudoInnerSpinButton: - case PseudoMeterHorizontalBar: - case PseudoMeterHorizontalOptimum: - case PseudoMeterHorizontalSuboptimal: - case PseudoMeterHorizontalEvenLessGood: - case PseudoMeterVerticalBar: - case PseudoMeterVerticalOptimum: - case PseudoMeterVerticalSuboptimal: - case PseudoMeterVerticalEvenLessGood: - case PseudoOuterSpinButton: + case PseudoOuterSpinButton: case PseudoResizer: case PseudoScrollbar: case PseudoScrollbarCorner: diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h index fdadafa..43e6d80 100644 --- a/Source/WebCore/css/CSSSelector.h +++ b/Source/WebCore/css/CSSSelector.h @@ -182,14 +182,6 @@ namespace WebCore { PseudoSearchDecoration, PseudoSearchResultsDecoration, PseudoSearchResultsButton, - PseudoMeterHorizontalBar, - PseudoMeterVerticalBar, - PseudoMeterHorizontalOptimum, - PseudoMeterHorizontalSuboptimal, - PseudoMeterHorizontalEvenLessGood, - PseudoMeterVerticalOptimum, - PseudoMeterVerticalSuboptimal, - PseudoMeterVerticalEvenLessGood, PseudoInputListButton, #if ENABLE(INPUT_SPEECH) PseudoInputSpeechButton, diff --git a/Source/WebCore/css/CSSStyleApplyProperty.cpp b/Source/WebCore/css/CSSStyleApplyProperty.cpp index e075615..6051334 100644 --- a/Source/WebCore/css/CSSStyleApplyProperty.cpp +++ b/Source/WebCore/css/CSSStyleApplyProperty.cpp @@ -27,6 +27,9 @@ #include "CSSPrimitiveValueMappings.h" #include "CSSStyleSelector.h" +#include "CSSValueList.h" +#include "Document.h" +#include "Element.h" #include "RenderStyle.h" #include #include @@ -35,11 +38,47 @@ using namespace std; namespace WebCore { -class ApplyPropertyNull : public ApplyPropertyBase { +class ApplyPropertyExpanding : public ApplyPropertyBase { public: - virtual void inherit(CSSStyleSelector*) const {} - virtual void initial(CSSStyleSelector*) const {} - virtual void value(CSSStyleSelector*, CSSValue*) const {} + ApplyPropertyExpanding(ApplyPropertyBase* one = 0, ApplyPropertyBase* two = 0, ApplyPropertyBase *three = 0, ApplyPropertyBase* four = 0) + { + m_propertyMap[0] = one; + m_propertyMap[1] = two; + m_propertyMap[2] = three; + m_propertyMap[3] = four; + m_propertyMap[4] = 0; // always null terminated + } + + virtual void applyInheritValue(CSSStyleSelector* selector) const + { + for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++) + (*e)->applyInheritValue(selector); + } + + virtual void applyInitialValue(CSSStyleSelector* selector) const + { + for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++) + (*e)->applyInitialValue(selector); + } + + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const + { + for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++) + (*e)->applyValue(selector, value); + } +private: + ApplyPropertyBase* m_propertyMap[5]; +}; + +class ApplyPropertyExpandingSuppressValue : public ApplyPropertyExpanding { +public: + ApplyPropertyExpandingSuppressValue(ApplyPropertyBase* one = 0, ApplyPropertyBase* two = 0, ApplyPropertyBase *three = 0, ApplyPropertyBase* four = 0) + : ApplyPropertyExpanding(one, two, three, four) {} + + virtual void applyValue(CSSStyleSelector*, CSSValue*) const + { + ASSERT_NOT_REACHED(); + } }; template @@ -52,17 +91,17 @@ public: { } - virtual void inherit(CSSStyleSelector* selector) const + virtual void applyInheritValue(CSSStyleSelector* selector) const { (selector->style()->*m_setter)((selector->parentStyle()->*m_getter)()); } - virtual void initial(CSSStyleSelector* selector) const + virtual void applyInitialValue(CSSStyleSelector* selector) const { (selector->style()->*m_setter)((*m_initial)()); } - virtual void value(CSSStyleSelector* selector, CSSValue* value) const + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const { if (value->isPrimitiveValue()) (selector->style()->*m_setter)(*(static_cast(value))); @@ -83,7 +122,7 @@ public: , m_setter(setter) { } - virtual void inherit(CSSStyleSelector* selector) const + virtual void applyInheritValue(CSSStyleSelector* selector) const { const Color& color = (selector->parentStyle()->*m_getter)(); if (m_defaultValue && !color.isValid()) @@ -91,12 +130,12 @@ public: else (selector->style()->*m_setter)(color); } - virtual void initial(CSSStyleSelector* selector) const + virtual void applyInitialValue(CSSStyleSelector* selector) const { Color color; (selector->style()->*m_setter)(color); } - virtual void value(CSSStyleSelector* selector, CSSValue* value) const + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const { if (value->isPrimitiveValue()) (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(static_cast(value))); @@ -115,44 +154,227 @@ public: { } - virtual void initial(CSSStyleSelector* selector) const + virtual void applyInitialValue(CSSStyleSelector* selector) const { (selector->style()->*m_setter)(m_initialValue()); } - virtual void value(CSSStyleSelector* selector, CSSValue* value) const + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const { if (!value->isPrimitiveValue()) return; if ((static_cast(value))->getIdent() == CSSValueCurrentcolor) - inherit(selector); + applyInheritValue(selector); else - ApplyPropertyColorBase::value(selector, value); + ApplyPropertyColorBase::applyValue(selector, value); } protected: Color (*m_initialValue)(); }; +// CSSPropertyDirection +class ApplyPropertyDirection : public ApplyPropertyDefault { +public: + ApplyPropertyDirection(TextDirection (RenderStyle::*getter)() const, void (RenderStyle::*setter)(TextDirection), TextDirection (*initial)()) + : ApplyPropertyDefault(getter, setter, initial) + { + } + + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const + { + ApplyPropertyDefault::applyValue(selector, value); + Element* element = selector->element(); + if (element && selector->element() == element->document()->documentElement()) + element->document()->setDirectionSetOnDocumentElement(true); + } +}; + +template +class ApplyPropertyFillLayer : public ApplyPropertyBase { +public: + ApplyPropertyFillLayer(CSSPropertyID propertyId, EFillLayerType fillLayerType, FillLayer* (RenderStyle::*accessLayers)(), + const FillLayer* (RenderStyle::*layers)() const, bool (FillLayer::*test)() const, T (FillLayer::*get)() const, + void (FillLayer::*set)(T), void (FillLayer::*clear)(), T (*initial)(EFillLayerType), + void (CSSStyleSelector::*mapFill)(CSSPropertyID, FillLayer*, CSSValue*)) + : m_propertyId(propertyId) + , m_fillLayerType(fillLayerType) + , m_accessLayers(accessLayers) + , m_layers(layers) + , m_test(test) + , m_get(get) + , m_set(set) + , m_clear(clear) + , m_initial(initial) + , m_mapFill(mapFill) + { + } + + virtual void applyInheritValue(CSSStyleSelector* selector) const + { + FillLayer* currChild = (selector->style()->*m_accessLayers)(); + FillLayer* prevChild = 0; + const FillLayer* currParent = (selector->parentStyle()->*m_layers)(); + while (currParent && (currParent->*m_test)()) { + if (!currChild) { + /* Need to make a new layer.*/ + currChild = new FillLayer(m_fillLayerType); + prevChild->setNext(currChild); + } + (currChild->*m_set)((currParent->*m_get)()); + prevChild = currChild; + currChild = prevChild->next(); + currParent = currParent->next(); + } + + while (currChild) { + /* Reset any remaining layers to not have the property set. */ + (currChild->*m_clear)(); + currChild = currChild->next(); + } + } + + virtual void applyInitialValue(CSSStyleSelector* selector) const + { + FillLayer* currChild = (selector->style()->*m_accessLayers)(); + (currChild->*m_set)((*m_initial)(m_fillLayerType)); + for (currChild = currChild->next(); currChild; currChild = currChild->next()) + (currChild->*m_clear)(); + } + + virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const + { + FillLayer* currChild = (selector->style()->*m_accessLayers)(); + FillLayer* prevChild = 0; + if (value->isValueList()) { + /* Walk each value and put it into a layer, creating new layers as needed. */ + CSSValueList* valueList = static_cast(value); + for (unsigned int i = 0; i < valueList->length(); i++) { + if (!currChild) { + /* Need to make a new layer to hold this value */ + currChild = new FillLayer(m_fillLayerType); + prevChild->setNext(currChild); + } + (selector->*m_mapFill)(m_propertyId, currChild, valueList->itemWithoutBoundsCheck(i)); + prevChild = currChild; + currChild = currChild->next(); + } + } else { + (selector->*m_mapFill)(m_propertyId, currChild, value); + currChild = currChild->next(); + } + while (currChild) { + /* Reset all remaining layers to not have the property set. */ + (currChild->*m_clear)(); + currChild = currChild->next(); + } + } + +protected: + CSSPropertyID m_propertyId; + EFillLayerType m_fillLayerType; + FillLayer* (RenderStyle::*m_accessLayers)(); + const FillLayer* (RenderStyle::*m_layers)() const; + bool (FillLayer::*m_test)() const; + T (FillLayer::*m_get)() const; + void (FillLayer::*m_set)(T); + void (FillLayer::*m_clear)(); + T (*m_initial)(EFillLayerType); + void (CSSStyleSelector::*m_mapFill)(CSSPropertyID, FillLayer*, CSSValue*); +}; + 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(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection)); + + setPropertyValue(CSSPropertyBackgroundAttachment, new ApplyPropertyFillLayer(CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment)); + setPropertyValue(CSSPropertyBackgroundClip, new ApplyPropertyFillLayer(CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip)); + setPropertyValue(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip); + setPropertyValue(CSSPropertyWebkitBackgroundComposite, new ApplyPropertyFillLayer(CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite)); + + setPropertyValue(CSSPropertyBackgroundImage, new ApplyPropertyFillLayer(CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage)); + + setPropertyValue(CSSPropertyBackgroundOrigin, new ApplyPropertyFillLayer(CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin)); + setPropertyValue(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin); + + setPropertyValue(CSSPropertyBackgroundPositionX, new ApplyPropertyFillLayer(CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition)); + setPropertyValue(CSSPropertyBackgroundPositionY, new ApplyPropertyFillLayer(CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition)); + setPropertyValue(CSSPropertyBackgroundPosition, new ApplyPropertyExpandingSuppressValue(propertyValue(CSSPropertyBackgroundPositionX), propertyValue(CSSPropertyBackgroundPositionY))); + + setPropertyValue(CSSPropertyBackgroundRepeatX, new ApplyPropertyFillLayer(CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX)); + setPropertyValue(CSSPropertyBackgroundRepeatY, new ApplyPropertyFillLayer(CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY)); + setPropertyValue(CSSPropertyBackgroundRepeat, new ApplyPropertyExpandingSuppressValue(propertyValue(CSSPropertyBackgroundRepeatX), propertyValue(CSSPropertyBackgroundRepeatY))); + + setPropertyValue(CSSPropertyBackgroundSize, new ApplyPropertyFillLayer(CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, + &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize)); + setPropertyValue(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize); + + setPropertyValue(CSSPropertyWebkitMaskAttachment, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment)); + setPropertyValue(CSSPropertyWebkitMaskClip, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip)); + setPropertyValue(CSSPropertyWebkitMaskComposite, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite)); + + setPropertyValue(CSSPropertyWebkitMaskImage, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage)); + + setPropertyValue(CSSPropertyWebkitMaskOrigin, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin)); + setPropertyValue(CSSPropertyWebkitMaskSize, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize)); + + setPropertyValue(CSSPropertyWebkitMaskPositionX, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition)); + setPropertyValue(CSSPropertyWebkitMaskPositionY, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition)); + setPropertyValue(CSSPropertyWebkitMaskPosition, new ApplyPropertyExpandingSuppressValue(propertyValue(CSSPropertyWebkitMaskPositionX), propertyValue(CSSPropertyWebkitMaskPositionY))); + + setPropertyValue(CSSPropertyWebkitMaskRepeatX, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX)); + setPropertyValue(CSSPropertyWebkitMaskRepeatY, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY)); + setPropertyValue(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpandingSuppressValue(propertyValue(CSSPropertyBackgroundRepeatX), propertyValue(CSSPropertyBackgroundRepeatY))); + + setPropertyValue(CSSPropertyWebkitMaskSize, new ApplyPropertyFillLayer(CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, + &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize)); + 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(CSSPropertyBorderTopStyle, new ApplyPropertyDefault(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle)); + setPropertyValue(CSSPropertyBorderRightStyle, new ApplyPropertyDefault(&RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle, &RenderStyle::initialBorderStyle)); + setPropertyValue(CSSPropertyBorderBottomStyle, new ApplyPropertyDefault(&RenderStyle::borderBottomStyle, &RenderStyle::setBorderBottomStyle, &RenderStyle::initialBorderStyle)); + setPropertyValue(CSSPropertyBorderLeftStyle, new ApplyPropertyDefault(&RenderStyle::borderLeftStyle, &RenderStyle::setBorderLeftStyle, &RenderStyle::initialBorderStyle)); + setPropertyValue(CSSPropertyOutlineColor, new ApplyPropertyColorBase(&RenderStyle::outlineColor, &RenderStyle::color, &RenderStyle::setOutlineColor)); + + setPropertyValue(CSSPropertyOverflowX, new ApplyPropertyDefault(&RenderStyle::overflowX, &RenderStyle::setOverflowX, &RenderStyle::initialOverflowX)); + setPropertyValue(CSSPropertyOverflowY, new ApplyPropertyDefault(&RenderStyle::overflowY, &RenderStyle::setOverflowY, &RenderStyle::initialOverflowY)); + setPropertyValue(CSSPropertyOverflow, new ApplyPropertyExpanding(propertyValue(CSSPropertyOverflowX), propertyValue(CSSPropertyOverflowY))); + 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)); diff --git a/Source/WebCore/css/CSSStyleApplyProperty.h b/Source/WebCore/css/CSSStyleApplyProperty.h index 48e08da..860a4f8 100644 --- a/Source/WebCore/css/CSSStyleApplyProperty.h +++ b/Source/WebCore/css/CSSStyleApplyProperty.h @@ -39,31 +39,32 @@ class ApplyPropertyBase { public: ApplyPropertyBase() { } virtual ~ApplyPropertyBase() { } - virtual void inherit(CSSStyleSelector*) const = 0; - virtual void initial(CSSStyleSelector*) const = 0; - virtual void value(CSSStyleSelector*, CSSValue*) const = 0; + virtual void applyInheritValue(CSSStyleSelector*) const = 0; + virtual void applyInitialValue(CSSStyleSelector*) const = 0; + virtual void applyValue(CSSStyleSelector*, CSSValue*) const = 0; }; -class CSSStyleApplyProperty : public RefCounted { +class CSSStyleApplyProperty { + WTF_MAKE_NONCOPYABLE(CSSStyleApplyProperty); public: static const CSSStyleApplyProperty& sharedCSSStyleApplyProperty(); - void inherit(CSSPropertyID property, CSSStyleSelector* selector) const + void applyInheritValue(CSSPropertyID property, CSSStyleSelector* selector) const { ASSERT(implements(property)); - propertyValue(property)->inherit(selector); + propertyValue(property)->applyInheritValue(selector); } - void initial(CSSPropertyID property, CSSStyleSelector* selector) const + void applyInitialValue(CSSPropertyID property, CSSStyleSelector* selector) const { ASSERT(implements(property)); - propertyValue(property)->initial(selector); + propertyValue(property)->applyInitialValue(selector); } - void value(CSSPropertyID property, CSSStyleSelector* selector, CSSValue* value) const + void applyValue(CSSPropertyID property, CSSStyleSelector* selector, CSSValue* value) const { ASSERT(implements(property)); - propertyValue(property)->value(selector, value); + propertyValue(property)->applyValue(selector, value); } bool implements(CSSPropertyID property) const @@ -90,6 +91,13 @@ private: m_propertyMap[index(property)] = value; } + void setPropertyValue(CSSPropertyID newProperty, CSSPropertyID equivalentProperty) + { + ASSERT(valid(newProperty)); + ASSERT(valid(equivalentProperty)); + m_propertyMap[index(newProperty)] = m_propertyMap[index(equivalentProperty)]; + } + ApplyPropertyBase* propertyValue(CSSPropertyID property) const { ASSERT(valid(property)); diff --git a/Source/WebCore/css/CSSStyleDeclaration.cpp b/Source/WebCore/css/CSSStyleDeclaration.cpp index 0a7aa1c..67dc6e0 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSStyleDeclaration.cpp @@ -107,10 +107,13 @@ bool CSSStyleDeclaration::isPropertyImplicit(const String& propertyName) void CSSStyleDeclaration::setProperty(const String& propertyName, const String& value, ExceptionCode& ec) { size_t important = value.find("!important", 0, false); + int propertyID = cssPropertyID(propertyName); + if (!propertyID) + return; if (important == notFound) - setProperty(propertyName, value, "", ec); + setProperty(propertyID, value, false, ec); else - setProperty(propertyName, value.left(important - 1), "important", ec); + setProperty(propertyID, value.left(important - 1), true, ec); } void CSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index 7387089..cbcdc0f 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -159,76 +159,6 @@ HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(prop, Prop, Value) \ if (primitiveValue) \ m_style->set##Prop(*primitiveValue); -#define HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(layerType, LayerType, prop, Prop) \ -if (isInherit) { \ - FillLayer* currChild = m_style->access##LayerType##Layers(); \ - FillLayer* prevChild = 0; \ - const FillLayer* currParent = m_parentStyle->layerType##Layers(); \ - while (currParent && currParent->is##Prop##Set()) { \ - if (!currChild) { \ - /* Need to make a new layer.*/ \ - currChild = new FillLayer(LayerType##FillLayer); \ - prevChild->setNext(currChild); \ - } \ - currChild->set##Prop(currParent->prop()); \ - prevChild = currChild; \ - currChild = prevChild->next(); \ - currParent = currParent->next(); \ - } \ - \ - while (currChild) { \ - /* Reset any remaining layers to not have the property set. */ \ - currChild->clear##Prop(); \ - currChild = currChild->next(); \ - } \ -} else if (isInitial) { \ - FillLayer* currChild = m_style->access##LayerType##Layers(); \ - currChild->set##Prop(FillLayer::initialFill##Prop(LayerType##FillLayer)); \ - for (currChild = currChild->next(); currChild; currChild = currChild->next()) \ - currChild->clear##Prop(); \ -} - -#define HANDLE_FILL_LAYER_VALUE(layerType, LayerType, prop, Prop, value) { \ -HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(layerType, LayerType, prop, Prop) \ -if (isInherit || isInitial) \ - return; \ -FillLayer* currChild = m_style->access##LayerType##Layers(); \ -FillLayer* prevChild = 0; \ -if (value->isValueList()) { \ - /* Walk each value and put it into a layer, creating new layers as needed. */ \ - CSSValueList* valueList = static_cast(value); \ - for (unsigned int i = 0; i < valueList->length(); i++) { \ - if (!currChild) { \ - /* Need to make a new layer to hold this value */ \ - currChild = new FillLayer(LayerType##FillLayer); \ - prevChild->setNext(currChild); \ - } \ - mapFill##Prop(property, currChild, valueList->itemWithoutBoundsCheck(i)); \ - prevChild = currChild; \ - currChild = currChild->next(); \ - } \ -} else { \ - mapFill##Prop(property, currChild, value); \ - currChild = currChild->next(); \ -} \ -while (currChild) { \ - /* Reset all remaining layers to not have the property set. */ \ - currChild->clear##Prop(); \ - currChild = currChild->next(); \ -} } - -#define HANDLE_BACKGROUND_INHERIT_AND_INITIAL(prop, Prop) \ -HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(background, Background, prop, Prop) - -#define HANDLE_BACKGROUND_VALUE(prop, Prop, value) \ -HANDLE_FILL_LAYER_VALUE(background, Background, prop, Prop, value) - -#define HANDLE_MASK_INHERIT_AND_INITIAL(prop, Prop) \ -HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(mask, Mask, prop, Prop) - -#define HANDLE_MASK_VALUE(prop, Prop, value) \ -HANDLE_FILL_LAYER_VALUE(mask, Mask, prop, Prop, value) - #define HANDLE_ANIMATION_INHERIT_AND_INITIAL(prop, Prop) \ if (isInherit) { \ AnimationList* list = m_style->accessAnimations(); \ @@ -439,11 +369,11 @@ RenderStyle* CSSStyleSelector::s_styleNotYetAvailable; static void loadFullDefaultStyle(); 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}"; +static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}head{display:none}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}"; static inline bool elementCanUseSimpleDefaultStyle(Element* e) { - return e->hasTagName(htmlTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || e->hasTagName(aTag); + return e->hasTagName(htmlTag) || e->hasTagName(headTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || e->hasTagName(aTag); } static inline void collectSiblingRulesInDefaultStyle() @@ -893,7 +823,7 @@ inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* paren { m_checker.m_pseudoStyle = pseudoID; - m_parentNode = e ? e->parentOrHostNode() : 0; + m_parentNode = e ? e->parentNodeForRenderingAndStyle() : 0; if (parentStyle) m_parentStyle = parentStyle; @@ -1158,7 +1088,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* node) const #if USE(ACCELERATED_COMPOSITING) // Turn off style sharing for elements that can gain layers for reasons outside of the style system. // See comments in RenderObject::setStyle(). - if (element->hasTagName(iframeTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) + if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) return false; #endif @@ -1345,12 +1275,6 @@ PassRefPtr CSSStyleSelector::styleForElement(Element* e, RenderStyl parentStyle = parentVisitedStyle; } visitedStyle = styleForElement(e, parentStyle, false, false, true); - if (visitedStyle) { - if (m_elementLinkState == InsideUnvisitedLink) - visitedStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that, since we don't need it. - else - visitedStyle->setStyleType(VISITED_LINK); - } initForStyleResolve(e, defaultParent); } @@ -1368,6 +1292,20 @@ PassRefPtr CSSStyleSelector::styleForElement(Element* e, RenderStyl m_style->setInsideLink(m_elementLinkState); } + if (visitedStyle) { + // Copy any pseudo bits that the visited style has to the primary style so that + // pseudo element styles will continue to work for pseudo elements inside :visited + // links. + for (unsigned pseudo = FIRST_PUBLIC_PSEUDOID; pseudo < FIRST_INTERNAL_PSEUDOID; ++pseudo) { + if (visitedStyle->hasPseudoStyle(static_cast(pseudo))) + m_style->setHasPseudoStyle(static_cast(pseudo)); + } + if (m_elementLinkState == InsideUnvisitedLink) + visitedStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that, since we don't need it. + else + visitedStyle->setStyleType(VISITED_LINK); + } + if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) { loadFullDefaultStyle(); assertNoSiblingRulesInDefaultStyle(); @@ -1554,14 +1492,6 @@ PassRefPtr CSSStyleSelector::styleForElement(Element* e, RenderStyl m_style->setUnique(); if (visitedStyle) { - // Copy any pseudo bits that the visited style has to the primary style so that - // pseudo element styles will continue to work for pseudo elements inside :visited - // links. - for (unsigned pseudo = FIRST_PUBLIC_PSEUDOID; pseudo < FIRST_INTERNAL_PSEUDOID; ++pseudo) { - if (visitedStyle->hasPseudoStyle(static_cast(pseudo))) - m_style->setHasPseudoStyle(static_cast(pseudo)); - } - // Add the visited style off the main style. m_style->addCachedPseudoStyle(visitedStyle.release()); } @@ -1694,12 +1624,8 @@ PassRefPtr CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, // Fetch our parent style with :visited in effect. RenderStyle* parentVisitedStyle = parentStyle->getCachedPseudoStyle(VISITED_LINK); visitedStyle = pseudoStyleForElement(pseudo, e, parentVisitedStyle ? parentVisitedStyle : parentStyle, true); - if (visitedStyle) { - if (m_elementLinkState == InsideUnvisitedLink) - visitedStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that. - else - visitedStyle->setStyleType(VISITED_LINK); - } + if (visitedStyle) + visitedStyle->setStyleType(VISITED_LINK); } initForStyleResolve(e, parentStyle, pseudo); @@ -1846,6 +1772,15 @@ static void addIntrinsicMargins(RenderStyle* style) } } +static inline bool isAtShadowBoundary(Element* element) +{ + if (!element) + return false; + + ContainerNode* parentNode = element->parentNode(); + return parentNode && parentNode->isShadowBoundary(); +} + void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { // Cache our original display. @@ -1970,7 +1905,7 @@ 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, 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 || (e && e->isShadowRoot())) + || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)) style->setTextDecorationsInEffect(style->textDecoration()); else style->addToTextDecorationsInEffect(style->textDecoration()); @@ -3086,7 +3021,7 @@ bool CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass(CSSSelector* s return false; } case CSSSelector::PseudoCornerPresent: - return scrollbar->scrollableArea()->scrollbarCornerPresent(); + return scrollbar->scrollableArea()->isScrollCornerVisible(); default: return false; } @@ -3596,6 +3531,19 @@ inline bool isValidVisitedLinkProperty(int id) return false; } +// SVG handles zooming in a different way compared to CSS. The whole document is scaled instead +// of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*() +// multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. +// Though all CSS values that can be applied to outermost elements (width/height/border/padding...) +// need to respect the scaling. RenderBox (the parent class of RenderSVGRoot) grabs values like +// width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale, +// if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific +// properties that are NOT allowed to scale within a zoomed SVG document (letter/word-spacing/font-size). +static inline bool useSVGZoomRules(const Element* e) +{ + return e && e->isSVGElement(); +} + void CSSStyleSelector::applyProperty(int id, CSSValue *value) { CSSPrimitiveValue* primitiveValue = 0; @@ -3604,16 +3552,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) float zoomFactor = m_style->effectiveZoom(); - // SVG handles zooming in a different way compared to CSS. The whole document is scaled instead - // of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*() - // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. - // Though all CSS values that can be applied to outermost elements (width/height/border/padding...) - // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot) grabs values like - // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale, - // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific - // properties that are NOT allowed to scale within a zoomed SVG document (letter/word-spacing/font-size). - bool useSVGZoomRules = m_element && m_element->isSVGElement(); - Length l; bool apply = false; @@ -3633,13 +3571,13 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // 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; + if (isInherit) + m_applyProperty.applyInheritValue(property, this); + else if (isInitial) + m_applyProperty.applyInitialValue(property, this); + else + m_applyProperty.applyValue(property, this, value); + return; } // What follows is a list that maps the CSS properties into their corresponding front-end @@ -3647,39 +3585,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // are only hit when mapping "inherit" or "initial" into front-end values. switch (property) { // ident only properties - case CSSPropertyBackgroundAttachment: - HANDLE_BACKGROUND_VALUE(attachment, Attachment, value) - return; - case CSSPropertyBackgroundClip: - case CSSPropertyWebkitBackgroundClip: - HANDLE_BACKGROUND_VALUE(clip, Clip, value) - return; - case CSSPropertyWebkitBackgroundComposite: - HANDLE_BACKGROUND_VALUE(composite, Composite, value) - return; - case CSSPropertyBackgroundOrigin: - case CSSPropertyWebkitBackgroundOrigin: - HANDLE_BACKGROUND_VALUE(origin, Origin, value) - return; - case CSSPropertyBackgroundSize: - case CSSPropertyWebkitBackgroundSize: - HANDLE_BACKGROUND_VALUE(size, Size, value) - return; - case CSSPropertyWebkitMaskAttachment: - HANDLE_MASK_VALUE(attachment, Attachment, value) - return; - case CSSPropertyWebkitMaskClip: - HANDLE_MASK_VALUE(clip, Clip, value) - return; - case CSSPropertyWebkitMaskComposite: - HANDLE_MASK_VALUE(composite, Composite, value) - return; - case CSSPropertyWebkitMaskOrigin: - HANDLE_MASK_VALUE(origin, Origin, value) - return; - case CSSPropertyWebkitMaskSize: - HANDLE_MASK_VALUE(size, Size, value) - return; case CSSPropertyBorderCollapse: HANDLE_INHERIT_AND_INITIAL(borderCollapse, BorderCollapse) if (!primitiveValue) @@ -3695,18 +3600,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } return; - case CSSPropertyBorderTopStyle: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderTopStyle, BorderTopStyle, BorderStyle) - return; - case CSSPropertyBorderRightStyle: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderRightStyle, BorderRightStyle, BorderStyle) - return; - case CSSPropertyBorderBottomStyle: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderBottomStyle, BorderBottomStyle, BorderStyle) - return; - case CSSPropertyBorderLeftStyle: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(borderLeftStyle, BorderLeftStyle, BorderStyle) - return; case CSSPropertyOutlineStyle: HANDLE_INHERIT_AND_INITIAL_WITH_VALUE(outlineStyle, OutlineStyle, BorderStyle) if (primitiveValue) { @@ -3722,11 +3615,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyClear: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(clear, Clear) return; - case CSSPropertyDirection: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(direction, Direction) - if (!isInherit && !isInitial && m_element && m_element == m_element->document()->documentElement()) - m_element->document()->setDirectionSetOnDocumentElement(true); - return; case CSSPropertyDisplay: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display) #if ENABLE(WCSS) @@ -3871,33 +3759,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyListStyleType: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(listStyleType, ListStyleType) return; - case CSSPropertyOverflow: - { - if (isInherit) { - m_style->setOverflowX(m_parentStyle->overflowX()); - m_style->setOverflowY(m_parentStyle->overflowY()); - return; - } - - if (isInitial) { - m_style->setOverflowX(RenderStyle::initialOverflowX()); - m_style->setOverflowY(RenderStyle::initialOverflowY()); - return; - } - - EOverflow o = *primitiveValue; - - m_style->setOverflowX(o); - m_style->setOverflowY(o); - return; - } - - case CSSPropertyOverflowX: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowX, OverflowX) - return; - case CSSPropertyOverflowY: - HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(overflowY, OverflowY) - return; case CSSPropertyPageBreakBefore: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(pageBreakBefore, PageBreakBefore, PageBreak) return; @@ -3940,51 +3801,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWhiteSpace: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(whiteSpace, WhiteSpace) return; - - case CSSPropertyBackgroundPosition: - HANDLE_BACKGROUND_INHERIT_AND_INITIAL(xPosition, XPosition); - HANDLE_BACKGROUND_INHERIT_AND_INITIAL(yPosition, YPosition); - return; - case CSSPropertyBackgroundPositionX: { - HANDLE_BACKGROUND_VALUE(xPosition, XPosition, value) - return; - } - case CSSPropertyBackgroundPositionY: { - HANDLE_BACKGROUND_VALUE(yPosition, YPosition, value) - return; - } - case CSSPropertyWebkitMaskPosition: - HANDLE_MASK_INHERIT_AND_INITIAL(xPosition, XPosition); - HANDLE_MASK_INHERIT_AND_INITIAL(yPosition, YPosition); - return; - case CSSPropertyWebkitMaskPositionX: { - HANDLE_MASK_VALUE(xPosition, XPosition, value) - return; - } - case CSSPropertyWebkitMaskPositionY: { - HANDLE_MASK_VALUE(yPosition, YPosition, value) - return; - } - case CSSPropertyBackgroundRepeat: - HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatX, RepeatX); - HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatY, RepeatY); - return; - case CSSPropertyBackgroundRepeatX: - HANDLE_BACKGROUND_VALUE(repeatX, RepeatX, value) - return; - case CSSPropertyBackgroundRepeatY: - HANDLE_BACKGROUND_VALUE(repeatY, RepeatY, value) - return; - case CSSPropertyWebkitMaskRepeat: - HANDLE_MASK_INHERIT_AND_INITIAL(repeatX, RepeatX); - HANDLE_MASK_INHERIT_AND_INITIAL(repeatY, RepeatY); - return; - case CSSPropertyWebkitMaskRepeatX: - HANDLE_MASK_VALUE(repeatX, RepeatX, value) - return; - case CSSPropertyWebkitMaskRepeatY: - HANDLE_MASK_VALUE(repeatY, RepeatY, value) - return; case CSSPropertyBorderSpacing: { if (isInherit) { m_style->setHorizontalBorderSpacing(m_parentStyle->horizontalBorderSpacing()); @@ -4051,12 +3867,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; // uri || inherit - case CSSPropertyBackgroundImage: - HANDLE_BACKGROUND_VALUE(image, Image, value) - return; - case CSSPropertyWebkitMaskImage: - HANDLE_MASK_VALUE(image, Image, value) - return; case CSSPropertyListStyleImage: { HANDLE_INHERIT_AND_INITIAL(listStyleImage, ListStyleImage) @@ -4175,7 +3985,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyLetterSpacing: case CSSPropertyWordSpacing: { - if (isInherit) { HANDLE_INHERIT_COND(CSSPropertyLetterSpacing, letterSpacing, LetterSpacing) HANDLE_INHERIT_COND(CSSPropertyWordSpacing, wordSpacing, WordSpacing) @@ -4193,7 +4002,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } else { if (!primitiveValue) return; - width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, useSVGZoomRules ? 1.0f : zoomFactor); + width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, useSVGZoomRules(m_element) ? 1.0f : zoomFactor); } switch (id) { case CSSPropertyLetterSpacing: @@ -5145,7 +4954,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) fontDescription.setUsePrinterFont(m_checker.m_document->printing()); // Handle the zoom factor. - fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules)); + fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules(m_element))); if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; } @@ -6197,18 +6006,54 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // These properties are implemented in the CSSStyleApplyProperty lookup table. case CSSPropertyColor: + case CSSPropertyDirection: + case CSSPropertyBackgroundAttachment: + case CSSPropertyBackgroundClip: + case CSSPropertyWebkitBackgroundClip: + case CSSPropertyWebkitBackgroundComposite: + case CSSPropertyBackgroundOrigin: + case CSSPropertyWebkitBackgroundOrigin: + case CSSPropertyBackgroundImage: + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: + case CSSPropertyWebkitMaskAttachment: + case CSSPropertyWebkitMaskClip: + case CSSPropertyWebkitMaskComposite: + case CSSPropertyWebkitMaskOrigin: + case CSSPropertyWebkitMaskImage: + case CSSPropertyWebkitMaskSize: case CSSPropertyBackgroundColor: case CSSPropertyBorderBottomColor: case CSSPropertyBorderLeftColor: case CSSPropertyBorderRightColor: case CSSPropertyBorderTopColor: + case CSSPropertyBorderTopStyle: + case CSSPropertyBorderRightStyle: + case CSSPropertyBorderBottomStyle: + case CSSPropertyBorderLeftStyle: case CSSPropertyOutlineColor: case CSSPropertyWebkitColumnRuleColor: case CSSPropertyWebkitTextEmphasisColor: case CSSPropertyWebkitTextFillColor: case CSSPropertyWebkitTextStrokeColor: + case CSSPropertyBackgroundPosition: + case CSSPropertyBackgroundPositionX: + case CSSPropertyBackgroundPositionY: + case CSSPropertyWebkitMaskPosition: + case CSSPropertyWebkitMaskPositionX: + case CSSPropertyWebkitMaskPositionY: + case CSSPropertyBackgroundRepeat: + case CSSPropertyBackgroundRepeatX: + case CSSPropertyBackgroundRepeatY: + case CSSPropertyWebkitMaskRepeat: + case CSSPropertyWebkitMaskRepeatX: + case CSSPropertyWebkitMaskRepeatY: + case CSSPropertyOverflow: + case CSSPropertyOverflowX: + case CSSPropertyOverflowY: ASSERT_NOT_REACHED(); return; +<<<<<<< HEAD #ifdef ANDROID_CSS_RING case CSSPropertyWebkitRing: @@ -6354,6 +6199,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } #endif +======= +>>>>>>> WebKit.org at r84325 #if ENABLE(SVG) default: // Try the SVG properties @@ -7069,6 +6916,13 @@ void CSSStyleSelector::setFontSize(FontDescription& fontDescription, float size) float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, RenderStyle* style, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules) { + // Text with a 0px font size should not be visible and therefore needs to be + // exempt from minimum font size rules. Acid3 relies on this for pixel-perfect + // rendering. This is also compatible with other browsers that have minimum + // font size settings (e.g. Firefox). + if (fabsf(specifiedSize) < std::numeric_limits::epsilon()) + return 0.0f; + float zoomFactor = 1.0f; if (!useSVGZoomRules) { zoomFactor = style->effectiveZoom(); diff --git a/Source/WebCore/css/CSSStyleSelector.h b/Source/WebCore/css/CSSStyleSelector.h index 756c5bf..ca512fd 100644 --- a/Source/WebCore/css/CSSStyleSelector.h +++ b/Source/WebCore/css/CSSStyleSelector.h @@ -85,6 +85,7 @@ public: // This class selects a RenderStyle for a given element based on a collection of stylesheets. class CSSStyleSelector { + friend class CSSStyleApplyProperty; WTF_MAKE_NONCOPYABLE(CSSStyleSelector); WTF_MAKE_FAST_ALLOCATED; public: CSSStyleSelector(Document*, StyleSheetList* authorSheets, CSSStyleSheet* mappedElementSheet, @@ -115,6 +116,7 @@ public: RenderStyle* style() const { return m_style.get(); } RenderStyle* parentStyle() const { return m_parentStyle; } + Element* element() const { return m_element; } private: void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); diff --git a/Source/WebCore/css/WebKitCSSMatrix.cpp b/Source/WebCore/css/WebKitCSSMatrix.cpp index 163eac8..26fe286 100644 --- a/Source/WebCore/css/WebKitCSSMatrix.cpp +++ b/Source/WebCore/css/WebKitCSSMatrix.cpp @@ -52,9 +52,8 @@ WebKitCSSMatrix::~WebKitCSSMatrix() void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) { - CSSParser p(true); RefPtr styleDeclaration = CSSMutableStyleDeclaration::create(); - if (p.parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true)) { + if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, true)) { // Convert to TransformOperations. This can fail if a property // requires style (i.e., param uses 'ems' or 'exs') RefPtr value = styleDeclaration->getPropertyCSSValue(CSSPropertyWebkitTransform); diff --git a/Source/WebCore/css/fullscreen.css b/Source/WebCore/css/fullscreen.css index 2e38c95..537024c 100644 --- a/Source/WebCore/css/fullscreen.css +++ b/Source/WebCore/css/fullscreen.css @@ -7,10 +7,13 @@ } video:-webkit-full-screen { - background-color: black; - width: auto; - height: 100%; - max-width: 100%; + background-color: black !important; + position: static !important; + margin: 0 !important; + height: 100% !important; + width: 100% !important; + -webkit-box-flex: 1 !important; + display: block !important; } img:-webkit-full-screen { diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index bd3bde0..ecbaef9 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -446,12 +446,16 @@ input::-webkit-input-list-button { input::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; display: inline-block; + position: relative; + cursor: default; -webkit-user-select: none; } input::-webkit-outer-spin-button { -webkit-appearance: outer-spin-button; display: inline-block; + position: relative; + cursor: default; margin-left: 2px; -webkit-user-select: none; } @@ -673,70 +677,59 @@ output { meter { -webkit-appearance: meter; - display: inline-block; + -webkit-box-sizing: border-box; + display: inline-box; height: 1em; width: 5em; vertical-align: -0.2em; } -meter::-webkit-meter { - -webkit-appearance: meter; -} - -meter::-webkit-meter-horizontal-bar { - -webkit-appearance: meter; +meter::-webkit-meter-bar { background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); + height: 100%; + -webkit-box-sizing: border-box; } -meter::-webkit-meter-vertical-bar { - -webkit-appearance: meter; - background: -webkit-gradient(linear, left top, right top, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); -} - -meter::-webkit-meter-horizontal-optimum-value { - -webkit-appearance: meter; +meter::-webkit-meter-optimum-value { background: -webkit-gradient(linear, left top, left bottom, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3)); + height: 100%; + -webkit-box-sizing: border-box; } -meter::-webkit-meter-horizontal-suboptimal-value { - -webkit-appearance: meter; +meter::-webkit-meter-suboptimum-value { background: -webkit-gradient(linear, left top, left bottom, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3)); + height: 100%; + -webkit-box-sizing: border-box; } -meter::-webkit-meter-horizontal-even-less-good-value { - -webkit-appearance: meter; +meter::-webkit-meter-even-less-good-value { background: -webkit-gradient(linear, left top, left bottom, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44)); -} - -meter::-webkit-meter-vertical-optimum-value { - -webkit-appearance: meter; - background: -webkit-gradient(linear, left top, right top, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3)); -} - -meter::-webkit-meter-vertical-suboptimal-value { - -webkit-appearance: meter; - background: -webkit-gradient(linear, left top, right top, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3)); -} - -meter::-webkit-meter-vertical-even-less-good-value { - -webkit-appearance: meter; - background: -webkit-gradient(linear, left top, right top, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44)); + height: 100%; + -webkit-box-sizing: border-box; } /* progress */ progress { -webkit-appearance: progress-bar; + -webkit-box-sizing: border-box; display: inline-block; height: 1em; width: 10em; vertical-align: -0.2em; +} + +progress::-webkit-progress-bar { background-color: gray; + height: 100%; + -webkit-box-sizing: border-box; } -progress::-webkit-progress-bar-value { - -webkit-appearance: progress-bar; +progress::-webkit-progress-value { background-color: green; + height: 100%; + width: 50%; /* should be removed later */ + -webkit-box-sizing: border-box; } /* datagrid */ @@ -894,6 +887,13 @@ summary { display: block } +summary::-webkit-details-marker { + display: inline-block; + width: 0.66em; + height: 0.66em; + margin-right: 0.4em; +} + /* page */ @page { diff --git a/Source/WebCore/css/mediaControls.css b/Source/WebCore/css/mediaControls.css index 874cb13..da61460 100644 --- a/Source/WebCore/css/mediaControls.css +++ b/Source/WebCore/css/mediaControls.css @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010, 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 @@ -29,6 +29,13 @@ audio { height: 16px; } +::-webkit-media-controls { + width: inherit; + height: inherit; + position: relative; + display: block; +} + audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { display: -webkit-box; -webkit-box-orient: horizontal; @@ -44,7 +51,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { } video:-webkit-full-page-media::-webkit-media-controls-panel { - bottom: -16px; + bottom: 0px; } audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { @@ -98,12 +105,7 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { 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; diff --git a/Source/WebCore/css/mediaControlsEfl.css b/Source/WebCore/css/mediaControlsEfl.css index 938d7e8..43d2698 100644 --- a/Source/WebCore/css/mediaControlsEfl.css +++ b/Source/WebCore/css/mediaControlsEfl.css @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2011 Samsung Electronics * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { } video:-webkit-full-page-media::-webkit-media-controls-panel { - bottom: -25px; + bottom: 0px; } audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { diff --git a/Source/WebCore/css/mediaControlsQt.css b/Source/WebCore/css/mediaControlsQt.css index 9ca3313..e32fcd5 100644 --- a/Source/WebCore/css/mediaControlsQt.css +++ b/Source/WebCore/css/mediaControlsQt.css @@ -69,6 +69,7 @@ audio::-webkit-media-controls-mute-button { height: 12px; padding: 6px; margin: 5px 5px 5px 3px; + border: none !important; } video::-webkit-media-controls-mute-button { @@ -76,6 +77,7 @@ video::-webkit-media-controls-mute-button { height: 12px; padding: 6px; margin: 5px 5px 5px 3px; + border: none !important; } audio::-webkit-media-controls-play-button { @@ -83,6 +85,7 @@ audio::-webkit-media-controls-play-button { height: 12px; padding: 6px 12px 6px 11px; margin: 5px 3px 5px 5px; + border: none !important; } video::-webkit-media-controls-play-button { @@ -90,6 +93,7 @@ video::-webkit-media-controls-play-button { height: 12px; padding: 6px 12px 6px 11px; margin: 5px 3px 5px 5px; + border: none !important; } audio::-webkit-media-controls-timeline-container { @@ -219,6 +223,7 @@ video::-webkit-media-controls-fullscreen-button { height: 12px; padding: 6px; margin: 5px 5px 5px 3px; + border: none !important; } audio::-webkit-media-controls-rewind-button { diff --git a/Source/WebCore/css/mediaControlsQuickTime.css b/Source/WebCore/css/mediaControlsQuickTime.css index 06f31ae..5866a91 100644 --- a/Source/WebCore/css/mediaControlsQuickTime.css +++ b/Source/WebCore/css/mediaControlsQuickTime.css @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010, 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 @@ -37,7 +37,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { } video:-webkit-full-page-media::-webkit-media-controls-panel { - bottom: -25px; + bottom: 0px; } audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { @@ -47,6 +47,7 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu height: 12px; margin-left: 2px; margin-right: 9px; + border: none !important; } audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { @@ -54,6 +55,7 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu height: 16px; margin-left: 6px; margin-right: 1px; + border: none !important; } audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container { @@ -122,11 +124,13 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { display: none; width: 0px; + border: none !important; } audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button { display: none; width: 0px; + border: none !important; } audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { @@ -135,6 +139,7 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f margin-left: 7px; margin-right: 7px; -webkit-box-ordinal-group: 4; /* At the very end */ + border: none !important; } audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { @@ -145,6 +150,7 @@ audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewin margin-bottom: 1px; margin-left: 6px; margin-right: 2px; + border: none !important; } audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { @@ -154,6 +160,7 @@ audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-co height: 11px; margin-left: 6px; margin-right: 2px; + border: none !important; } audio::-webkit-media-controls-status-display, video::-webkit-media-controls-status-display { @@ -186,6 +193,7 @@ audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-medi margin-left: 7px; margin-right: 7px; -webkit-box-ordinal-group: 3; /* between mute and fullscreen */ + border: none !important; } audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { @@ -221,4 +229,5 @@ audio::-webkit-media-controls-volume-slider-mute-button, video::-webkit-media-co width: 14px; height: 12px; + border: none !important; } diff --git a/Source/WebCore/css/themeQtMobile.css b/Source/WebCore/css/themeQtMobile.css deleted file mode 100644 index 27be523..0000000 --- a/Source/WebCore/css/themeQtMobile.css +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -input[type="button"], -input[type="submit"], -input[type="reset"], -input[type="file"]::-webkit-file-upload-button, button, -select { - padding: 2px 18px 3px 18px; - border: 1px solid gray; - -webkit-border-radius:5px; - background: -webkit-gradient(linear, left bottom, left top, color-stop(0.0, rgba(0, 0, 0, 0.35)), color-stop(0.4, rgba(0, 0, 0, 0.0))); - background-color: #ffffff; - color: #3e3e3e; -} - -input[type="button"]:disabled, -input[type="submit"]:disabled, -input[type="reset"]:disabled, -input[type="file"]:disabled::-webkit-file-upload-button, -button:disabled, -select:disabled { - border: 1px solid gray; -} - -input[type="button"]:active, -input[type="submit"]:active, -input[type="reset"]:active, -input[type="file"]:active::-webkit-file-upload-button, -button:active, -select:active { - background: ButtonShadow; -} - -input[type="button"]:active:disabled, -input[type="submit"]:active:disabled, -input[type="reset"]:active:disabled, -input[type="file"]:active:disabled::-webkit-file-upload-button, -button:active:disabled, -select:active:disabled { - border: 1px solid gray; -} - -input:not([type]), -input[type="text"], -input[type="password"], -input[type="email"], -input[type="tel"], -input[type="color"], -input[type="search"], -input[type="date"], -input[type="datetime"], -input[type="datetime-local"], -input[type="month"], -input[type="week"], -input[type="time"], -input[type="number"], -input[type="url"], -textarea { - border: 1px solid gray; - background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, rgba(0, 0, 0, 0.35)), color-stop(0.2, rgba(0, 0, 0, 0.0))); - background-color: #ffffff; - color: #3e3e3e; - -webkit-border-radius:5px; -} - -input:not([type]):disabled, -input[type="text"]:disabled, -input[type="password"]:disabled, -input[type="email"]:disabled, -input[type="tel"]:disabled, -input[type="color"]:disabled, -input[type="search"]:disabled, -input[type="date"]:disabled, -input[type="datetime"]:disabled, -input[type="datetime-local"]:disabled, -input[type="month"]:disabled, -input[type="week"]:disabled, -input[type="time"]:disabled, -input[type="number"]:disabled, -input[type="url"]:disabled, -textarea:disabled { - border: 1px solid gray; - background: -webkit-gradient(linear, left top, left 30, color-stop(0.0, rgba(0, 0, 0, 0.3)), color-stop(0.2, rgba(0, 0, 0, 0.0))); - background-color: #ffffff; - color: #e5e5e5; -} - -input:not([type]):active, -input[type="text"]:active, -input[type="password"]:active, -input[type="email"]:active, -input[type="tel"]:active, -input[type="color"]:active, -input[type="search"]:active, -input[type="date"]:active, -input[type="datetime"]:active, -input[type="datetime-local"]:active, -input[type="month"]:active, -input[type="week"]:active, -input[type="time"]:active, -input[type="number"]:active, -input[type="url"]:active, -textarea:active { - background: ButtonShadow; -} - -video { - background-color: #000000; -} diff --git a/Source/WebCore/css/tokenizer.flex b/Source/WebCore/css/tokenizer.flex index 88a92a2..3285d2f 100644 --- a/Source/WebCore/css/tokenizer.flex +++ b/Source/WebCore/css/tokenizer.flex @@ -15,7 +15,6 @@ string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' ident -?{nmstart}{nmchar}* -name {nmchar}+ num [0-9]+|[0-9]*"."[0-9]+ intnum [0-9]+ string {string1}|{string2} @@ -46,8 +45,8 @@ nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})? {ident} {yyTok = IDENT; return yyTok;} {nth} {yyTok = NTH; return yyTok;} +"#"{h}+ {yyTok = HEX; return yyTok;} "#"{ident} {yyTok = IDSEL; return yyTok;} -"#"{name} {yyTok = HEX; return yyTok;} "@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;} "@page" {yyTok = PAGE_SYM; return yyTok;} -- cgit v1.1