diff options
Diffstat (limited to 'WebCore/css')
45 files changed, 1187 insertions, 258 deletions
diff --git a/WebCore/css/CSSCanvasValue.cpp b/WebCore/css/CSSCanvasValue.cpp index cf8cb42..0c1c3f9 100644 --- a/WebCore/css/CSSCanvasValue.cpp +++ b/WebCore/css/CSSCanvasValue.cpp @@ -47,15 +47,15 @@ String CSSCanvasValue::cssText() const void CSSCanvasValue::canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) { IntRect imageChangeRect = enclosingIntRect(changedRect); - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this), &imageChangeRect); } void CSSCanvasValue::canvasResized(HTMLCanvasElement*) { - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this)); } diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index 8a91140..34b93c1 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -62,6 +62,7 @@ static const int computedProperties[] = { CSSPropertyBackgroundOrigin, CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard CSSPropertyBackgroundRepeat, + CSSPropertyBackgroundSize, CSSPropertyBorderBottomColor, CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderBottomRightRadius, @@ -80,7 +81,6 @@ static const int computedProperties[] = { CSSPropertyBorderTopStyle, CSSPropertyBorderTopWidth, CSSPropertyBottom, - CSSPropertyBoxShadow, CSSPropertyCaptionSide, CSSPropertyClear, CSSPropertyClip, @@ -132,6 +132,7 @@ static const int computedProperties[] = { CSSPropertyTextAlign, CSSPropertyTextDecoration, CSSPropertyTextIndent, + CSSPropertyTextRendering, CSSPropertyTextShadow, CSSPropertyTextOverflow, CSSPropertyTextTransform, @@ -160,7 +161,6 @@ static const int computedProperties[] = { CSSPropertyWebkitBackgroundClip, CSSPropertyWebkitBackgroundComposite, CSSPropertyWebkitBackgroundOrigin, - CSSPropertyWebkitBackgroundSize, CSSPropertyWebkitBorderFit, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderImage, @@ -174,6 +174,7 @@ static const int computedProperties[] = { CSSPropertyWebkitBoxOrient, CSSPropertyWebkitBoxPack, CSSPropertyWebkitBoxReflect, + CSSPropertyWebkitBoxShadow, CSSPropertyWebkitBoxSizing, CSSPropertyWebkitColumnBreakAfter, CSSPropertyWebkitColumnBreakBefore, @@ -187,6 +188,7 @@ static const int computedProperties[] = { #if ENABLE(DASHBOARD_SUPPORT) CSSPropertyWebkitDashboardRegion, #endif + CSSPropertyWebkitFontSmoothing, CSSPropertyWebkitHighlight, CSSPropertyWebkitLineBreak, CSSPropertyWebkitLineClamp, @@ -255,7 +257,6 @@ static const int computedProperties[] = { CSSPropertyStrokeMiterlimit, CSSPropertyStrokeOpacity, CSSPropertyStrokeWidth, - CSSPropertyTextRendering, CSSPropertyAlignmentBaseline, CSSPropertyBaselineShift, CSSPropertyDominantBaseline, @@ -627,6 +628,32 @@ static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecorati return list; } +static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat) +{ + // For backwards compatibility, if both values are equal, just return one of them. And + // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand. + if (xRepeat == yRepeat) + return CSSPrimitiveValue::create(xRepeat); + if (xRepeat == CSSValueRepeat && yRepeat == CSSValueNoRepeat) + return CSSPrimitiveValue::createIdentifier(CSSValueRepeatX); + if (xRepeat == CSSValueNoRepeat && yRepeat == CSSValueRepeat) + return CSSPrimitiveValue::createIdentifier(CSSValueRepeatY); + + RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); + list->append(CSSPrimitiveValue::create(xRepeat)); + list->append(CSSPrimitiveValue::create(yRepeat)); + return list.release(); +} + +static void logUnimplementedPropertyID(int propertyID) +{ + DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ()); + if (!propertyIDSet.add(propertyID).second) + return; + + LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID))); +} + PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const { Node* node = m_node.get(); @@ -661,14 +688,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper if (style->backgroundImage()) return style->backgroundImage()->cssValue(); return CSSPrimitiveValue::createIdentifier(CSSValueNone); - case CSSPropertyWebkitBackgroundSize: { + case CSSPropertyBackgroundSize: { + EFillSizeType size = style->backgroundSizeType(); + if (size == Contain) + return CSSPrimitiveValue::createIdentifier(CSSValueContain); + if (size == Cover) + return CSSPrimitiveValue::createIdentifier(CSSValueCover); RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); - list->append(CSSPrimitiveValue::create(style->backgroundSize().width())); - list->append(CSSPrimitiveValue::create(style->backgroundSize().height())); + list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().width())); + list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().height())); return list.release(); } case CSSPropertyBackgroundRepeat: - return CSSPrimitiveValue::create(style->backgroundRepeat()); + return fillRepeatToCSSValue(style->backgroundRepeatX(), style->backgroundRepeatY()); case CSSPropertyWebkitBackgroundComposite: return CSSPrimitiveValue::create(style->backgroundComposite()); case CSSPropertyBackgroundAttachment: @@ -756,7 +788,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper } case CSSPropertyWebkitBoxReflect: return valueForReflection(style->boxReflect()); - case CSSPropertyBoxShadow: + case CSSPropertyWebkitBoxShadow: return valueForShadow(style->boxShadow(), static_cast<CSSPropertyID>(propertyID)); case CSSPropertyCaptionSide: return CSSPrimitiveValue::create(style->captionSide()); @@ -942,7 +974,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return list.release(); } case CSSPropertyWebkitMaskRepeat: - return CSSPrimitiveValue::create(style->maskRepeat()); + return fillRepeatToCSSValue(style->maskRepeatX(), style->maskRepeatY()); case CSSPropertyWebkitMaskAttachment: return CSSPrimitiveValue::create(style->maskAttachment()); case CSSPropertyWebkitMaskComposite: @@ -1053,6 +1085,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return CSSPrimitiveValue::create(style->textIndent()); case CSSPropertyTextShadow: return valueForShadow(style->textShadow(), static_cast<CSSPropertyID>(propertyID)); + case CSSPropertyTextRendering: + return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode()); case CSSPropertyTextOverflow: if (style->textOverflow()) return CSSPrimitiveValue::createIdentifier(CSSValueEllipsis); @@ -1141,6 +1175,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return CSSPrimitiveValue::create(style->matchNearestMailBlockquoteColor()); case CSSPropertyResize: return CSSPrimitiveValue::create(style->resize()); + case CSSPropertyWebkitFontSmoothing: + return CSSPrimitiveValue::create(style->fontDescription().fontSmoothing()); case CSSPropertyZIndex: if (style->hasAutoZIndex()) return CSSPrimitiveValue::createIdentifier(CSSValueAuto); @@ -1435,7 +1471,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper #endif } - LOG_ERROR("unimplemented propertyID: %d", propertyID); + logUnimplementedPropertyID(propertyID); return 0; } diff --git a/WebCore/css/CSSCursorImageValue.cpp b/WebCore/css/CSSCursorImageValue.cpp index 13c55a8..c1a517c 100644 --- a/WebCore/css/CSSCursorImageValue.cpp +++ b/WebCore/css/CSSCursorImageValue.cpp @@ -39,7 +39,7 @@ namespace WebCore { #if ENABLE(SVG) static inline bool isSVGCursorIdentifier(const String& url) { - KURL kurl(url); + KURL kurl(ParsedURLString, url); return kurl.hasFragmentIdentifier(); } diff --git a/WebCore/css/CSSImageGeneratorValue.cpp b/WebCore/css/CSSImageGeneratorValue.cpp index 6e23d95..4cf0873 100644 --- a/WebCore/css/CSSImageGeneratorValue.cpp +++ b/WebCore/css/CSSImageGeneratorValue.cpp @@ -49,24 +49,42 @@ void CSSImageGeneratorValue::addClient(RenderObject* renderer, const IntSize& si ref(); if (!size.isEmpty()) m_sizes.add(size); - m_clients.add(renderer, size); + + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + if (it == m_clients.end()) + m_clients.add(renderer, SizeCountPair(size, 1)); + else { + SizeCountPair& sizeCount = it->second; + ++sizeCount.second; + } } void CSSImageGeneratorValue::removeClient(RenderObject* renderer) { - IntSize size = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize size = sizeCount.first; if (!size.isEmpty()) { m_sizes.remove(size); if (!m_sizes.contains(size)) m_images.remove(size); } - m_clients.remove(renderer); + + if (!--sizeCount.second) + m_clients.remove(renderer); + deref(); } Image* CSSImageGeneratorValue::getImage(RenderObject* renderer, const IntSize& size) { - IntSize oldSize = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize oldSize = sizeCount.first; if (oldSize != size) { removeClient(renderer); addClient(renderer, size); diff --git a/WebCore/css/CSSImageGeneratorValue.h b/WebCore/css/CSSImageGeneratorValue.h index 661fd37..c053bfe 100644 --- a/WebCore/css/CSSImageGeneratorValue.h +++ b/WebCore/css/CSSImageGeneratorValue.h @@ -57,8 +57,11 @@ protected: Image* getImage(RenderObject*, const IntSize&); void putImage(const IntSize&, PassRefPtr<Image>); + typedef pair<IntSize, int> SizeCountPair; + typedef HashMap<RenderObject*, SizeCountPair> RenderObjectSizeCountMap; + HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use. - HashMap<RenderObject*, IntSize> m_clients; // A map from RenderObjects to image sizes. + RenderObjectSizeCountMap m_clients; // A map from RenderObjects (with entry count) to image sizes. HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size. RefPtr<StyleGeneratedImage> m_image; diff --git a/WebCore/css/CSSImageValue.cpp b/WebCore/css/CSSImageValue.cpp index 7fc99bb..3432a4e 100644 --- a/WebCore/css/CSSImageValue.cpp +++ b/WebCore/css/CSSImageValue.cpp @@ -63,7 +63,7 @@ StyleCachedImage* CSSImageValue::cachedImage(DocLoader* loader, const String& ur cachedImage = loader->requestImage(url); else { // FIXME: Should find a way to make these images sit in their own memory partition, since they are user agent images. - cachedImage = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url), String())); + cachedImage = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(ParsedURLString, url), String())); } if (cachedImage) { diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp index 50e60f4..2fe7abf 100644 --- a/WebCore/css/CSSImportRule.cpp +++ b/WebCore/css/CSSImportRule.cpp @@ -1,7 +1,7 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2002, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2002, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +26,8 @@ #include "DocLoader.h" #include "Document.h" #include "MediaList.h" +#include "Settings.h" +#include <wtf/StdLibExtras.h> namespace WebCore { @@ -60,7 +62,20 @@ void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, c CSSStyleSheet* parent = parentStyleSheet(); bool strict = !parent || parent->useStrictParsing(); - m_styleSheet->parseString(sheet->sheetText(strict), strict); + String sheetText = sheet->sheetText(strict); + m_styleSheet->parseString(sheetText, strict); + + if (strict && parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks()) { + // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>. + DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css")); + DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n")); + if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) { + ASSERT(m_styleSheet->length() == 1); + ExceptionCode ec; + m_styleSheet->deleteRule(0, ec); + } + } + m_loading = false; if (parent) @@ -85,7 +100,7 @@ void CSSImportRule::insertedIntoParent() String absHref = m_strHref; if (!parentSheet->href().isNull()) // use parent styleheet's URL as the base URL - absHref = KURL(KURL(parentSheet->href()), m_strHref).string(); + absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string(); // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. @@ -96,7 +111,10 @@ void CSSImportRule::insertedIntoParent() root = curr; } - m_cachedSheet = docLoader->requestCSSStyleSheet(absHref, parentSheet->charset()); + if (parentSheet->isUserStyleSheet()) + m_cachedSheet = docLoader->requestUserCSSStyleSheet(absHref, parentSheet->charset()); + else + m_cachedSheet = docLoader->requestCSSStyleSheet(absHref, parentSheet->charset()); if (m_cachedSheet) { // if the import rule is issued dynamically, the sheet may be // removed from the pending sheet count, so let the doc know @@ -129,4 +147,26 @@ void CSSImportRule::addSubresourceStyleURLs(ListHashSet<KURL>& urls) addSubresourceURL(urls, m_styleSheet->baseURL()); } +#ifdef ANDROID_INSTRUMENT +void* CSSImportRule::operator new(size_t size) +{ + return StyleBase::operator new(size); +} + +void* CSSImportRule::operator new[](size_t size) +{ + return StyleBase::operator new[](size); +} + +void CSSImportRule::operator delete(void* p, size_t size) +{ + StyleBase::operator delete(p, size); +} + +void CSSImportRule::operator delete[](void* p, size_t size) +{ + StyleBase::operator delete[](p, size); +} +#endif + } // namespace WebCore diff --git a/WebCore/css/CSSImportRule.h b/WebCore/css/CSSImportRule.h index f546006..c58088c 100644 --- a/WebCore/css/CSSImportRule.h +++ b/WebCore/css/CSSImportRule.h @@ -65,6 +65,14 @@ private: // from CachedResourceClient virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); +#ifdef ANDROID_INSTRUMENT + // Overridden to resolve the ambiguous + void* operator new(size_t size); + void* operator new[](size_t size); + void operator delete(void* p, size_t size); + void operator delete[](void* p, size_t size); +#endif + String m_strHref; RefPtr<MediaList> m_lstMedia; RefPtr<CSSStyleSheet> m_styleSheet; diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 8ff5300..2dd2f5d 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -28,6 +28,7 @@ #include "CSSPropertyNames.h" #include "CSSRule.h" #include "CSSStyleSheet.h" +#include "CSSValueKeywords.h" #include "CSSValueList.h" #include "Document.h" #include "ExceptionCode.h" @@ -110,15 +111,24 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const switch (propertyID) { case CSSPropertyBackgroundPosition: { // FIXME: Is this correct? The code in cssparser.cpp is confusing - const int properties[2] = { CSSPropertyBackgroundPositionX, - CSSPropertyBackgroundPositionY }; + const int properties[2] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY }; + return getLayeredShorthandValue(properties, 2); + } + case CSSPropertyBackgroundRepeat: { + const int properties[2] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; return getLayeredShorthandValue(properties, 2); } case CSSPropertyBackground: { - const int properties[7] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat, - CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyBackgroundClip, - CSSPropertyBackgroundOrigin, CSSPropertyBackgroundColor }; - return getLayeredShorthandValue(properties, 7); + const int properties[9] = { CSSPropertyBackgroundColor, + CSSPropertyBackgroundImage, + CSSPropertyBackgroundRepeatX, + CSSPropertyBackgroundRepeatY, + CSSPropertyBackgroundAttachment, + CSSPropertyBackgroundPositionX, + CSSPropertyBackgroundPositionY, + CSSPropertyBackgroundClip, + CSSPropertyBackgroundOrigin }; + return getLayeredShorthandValue(properties, 9); } case CSSPropertyBorder: { const int properties[3][4] = {{ CSSPropertyBorderTopWidth, @@ -206,8 +216,11 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const } case CSSPropertyWebkitMaskPosition: { // FIXME: Is this correct? The code in cssparser.cpp is confusing - const int properties[2] = { CSSPropertyWebkitMaskPositionX, - CSSPropertyWebkitMaskPositionY }; + const int properties[2] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY }; + return getLayeredShorthandValue(properties, 2); + } + case CSSPropertyWebkitMaskRepeat: { + const int properties[2] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY }; return getLayeredShorthandValue(properties, 2); } case CSSPropertyWebkitMask: { @@ -286,6 +299,9 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie // can safely be omitted. for (size_t i = 0; i < numLayers; i++) { String layerRes; + bool useRepeatXShorthand = false; + bool useRepeatYShorthand = false; + bool useSingleWordShorthand = false; for (size_t j = 0; j < number; j++) { RefPtr<CSSValue> value; if (values[j]) { @@ -302,11 +318,50 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie value = 0; } } + + // We need to report background-repeat as it was written in the CSS. If the property is implicit, + // then it was written with only one value. Here we figure out which value that was so we can + // report back correctly. + if (properties[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(properties[j])) { + if (j < number - 1 && properties[j + 1] == CSSPropertyBackgroundRepeatY) { + RefPtr<CSSValue> yValue; + RefPtr<CSSValue> nextValue = values[j + 1]; + if (nextValue->isValueList()) + yValue = static_cast<CSSValueList*>(nextValue.get())->itemWithoutBoundsCheck(i); + else + yValue = nextValue; + + int xId = static_cast<CSSPrimitiveValue*>(value.get())->getIdent(); + int yId = static_cast<CSSPrimitiveValue*>(yValue.get())->getIdent(); + if (xId != yId) { + if (xId == CSSValueRepeat && yId == CSSValueNoRepeat) { + useRepeatXShorthand = true; + ++j; + } else if (xId == CSSValueNoRepeat && yId == CSSValueRepeat) { + useRepeatYShorthand = true; + continue; + } + } else { + useSingleWordShorthand = true; + ++j; + } + } + } if (value && !value->isImplicitInitialValue()) { if (!layerRes.isNull()) layerRes += " "; - layerRes += value->cssText(); + if (useRepeatXShorthand) { + useRepeatXShorthand = false; + layerRes += getValueName(CSSValueRepeatX); + } else if (useRepeatYShorthand) { + useRepeatYShorthand = false; + layerRes += getValueName(CSSValueRepeatY); + } else if (useSingleWordShorthand) { + useSingleWordShorthand = false; + layerRes += value->cssText(); + } else + layerRes += value->cssText(); } } @@ -583,6 +638,8 @@ String CSSMutableStyleDeclaration::cssText() const const CSSProperty* positionXProp = 0; const CSSProperty* positionYProp = 0; + const CSSProperty* repeatXProp = 0; + const CSSProperty* repeatYProp = 0; unsigned size = m_properties.size(); for (unsigned n = 0; n < size; ++n) { @@ -591,6 +648,10 @@ String CSSMutableStyleDeclaration::cssText() const positionXProp = ∝ else if (prop.id() == CSSPropertyBackgroundPositionY) positionYProp = ∝ + else if (prop.id() == CSSPropertyBackgroundRepeatX) + repeatXProp = ∝ + else if (prop.id() == CSSPropertyBackgroundRepeatY) + repeatYProp = ∝ else result += prop.cssText(); } @@ -614,6 +675,22 @@ String CSSMutableStyleDeclaration::cssText() const result += positionYProp->cssText(); } + // FIXME: We need to do the same for background-repeat. + if (repeatXProp && repeatYProp && repeatXProp->isImportant() == repeatYProp->isImportant()) { + String repeatValue; + const int repeatProperties[2] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; + if (repeatXProp->value()->isValueList() || repeatYProp->value()->isValueList()) + repeatValue = getLayeredShorthandValue(repeatProperties, 2); + else + repeatValue = repeatXProp->value()->cssText() + " " + repeatYProp->value()->cssText(); + result += "background-repeat: " + repeatValue + (repeatXProp->isImportant() ? " !important" : "") + "; "; + } else { + if (repeatXProp) + result += repeatXProp->cssText(); + if (repeatYProp) + result += repeatYProp->cssText(); + } + return result; } diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index b79992f..b7155b3 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -171,7 +172,7 @@ CSSParser::~CSSParser() } delete m_floatingMediaQueryExp; delete m_floatingMediaQuery; - deleteAllValues(m_floatingSelectors); + fastDeleteAllValues(m_floatingSelectors); deleteAllValues(m_floatingValueLists); deleteAllValues(m_floatingFunctions); deleteAllValues(m_reusableSelectorVector); @@ -747,7 +748,11 @@ bool CSSParser::parseValue(int propId, bool important) // inline | block | list-item | run-in | inline-block | table | // inline-table | table-row-group | table-header-group | table-footer-group | table-row | // table-column-group | table-column | table-cell | table-caption | box | inline-box | none | inherit +#if ENABLE(WCSS) + if ((id >= CSSValueInline && id <= CSSValueWapMarquee) || id == CSSValueNone) +#else if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone) +#endif valid_primitive = true; break; @@ -920,8 +925,10 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBackgroundPosition: case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: - case CSSPropertyWebkitBackgroundSize: + case CSSPropertyBackgroundSize: case CSSPropertyBackgroundRepeat: + case CSSPropertyBackgroundRepeatX: + case CSSPropertyBackgroundRepeatY: case CSSPropertyWebkitMaskAttachment: case CSSPropertyWebkitMaskClip: case CSSPropertyWebkitMaskComposite: @@ -931,17 +938,21 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitMaskPositionX: case CSSPropertyWebkitMaskPositionY: case CSSPropertyWebkitMaskSize: - case CSSPropertyWebkitMaskRepeat: { + case CSSPropertyWebkitMaskRepeat: + case CSSPropertyWebkitMaskRepeatX: + case CSSPropertyWebkitMaskRepeatY: { RefPtr<CSSValue> val1; RefPtr<CSSValue> val2; int propId1, propId2; + bool result = false; if (parseFillProperty(propId, propId1, propId2, val1, val2)) { addProperty(propId1, val1.release(), important); if (val2) addProperty(propId2, val2.release(), important); - return true; + result = true; } - return false; + m_implicitShorthand = false; + return result; } case CSSPropertyListStyleImage: // <uri> | none | inherit if (id == CSSValueNone) { @@ -1231,7 +1242,7 @@ bool CSSParser::parseValue(int propId, bool important) valid_primitive = validUnit(value, FLength, m_strict); break; case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS3, so treat as CSS3 - case CSSPropertyBoxShadow: + case CSSPropertyWebkitBoxShadow: if (id == CSSValueNone) valid_primitive = true; else @@ -1313,6 +1324,28 @@ bool CSSParser::parseValue(int propId, bool important) else valid_primitive = validUnit(value, FTime|FInteger|FNonNeg, m_strict); break; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + if (id == CSSValueLtr || id == CSSValueRtl) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeStyle: + if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeLoop: + if (id == CSSValueInfinite) + valid_primitive = true; + else + valid_primitive = validUnit(value, FInteger | FNonNeg, m_strict); + break; + case CSSPropertyWapMarqueeSpeed: + if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) + valid_primitive = true; + else + valid_primitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); + break; +#endif case CSSPropertyWebkitUserDrag: // auto | none | element if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement) valid_primitive = true; @@ -1452,6 +1485,11 @@ bool CSSParser::parseValue(int propId, bool important) id == CSSValueWave) valid_primitive = true; break; + case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision + if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility + || id == CSSValueGeometricprecision) + valid_primitive = true; + break; case CSSPropertyTextLineThroughWidth: case CSSPropertyTextOverlineWidth: case CSSPropertyTextUnderlineWidth: @@ -1542,6 +1580,12 @@ bool CSSParser::parseValue(int propId, bool important) valid_primitive = true; break; + case CSSPropertyWebkitFontSmoothing: + if (id == CSSValueAuto || id == CSSValueNone + || id == CSSValueAntialiased || id == CSSValueSubpixelAntialiased) + valid_primitive = true; + break; + #if ENABLE(DASHBOARD_SUPPORT) case CSSPropertyWebkitDashboardRegion: // <dashboard-region> | <dashboard-region> if (value->unit == CSSParserValue::Function || id == CSSValueNone) @@ -1554,7 +1598,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBackground: { // Position must come before color in this array because a plain old "0" is a legal color // in quirks mode but it's usually the X coordinate of a position. - // FIXME: Add CSSPropertyWebkitBackgroundSize to the shorthand. + // FIXME: Add CSSPropertyBackgroundSize to the shorthand. const int properties[] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyBackgroundOrigin, CSSPropertyBackgroundColor }; @@ -1736,7 +1780,7 @@ void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval) lval = rval; } -const int cMaxFillProperties = 7; +const int cMaxFillProperties = 9; bool CSSParser::parseFillShorthand(int propId, const int* properties, int numProperties, bool important) { @@ -1750,6 +1794,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro RefPtr<CSSValue> values[cMaxFillProperties]; RefPtr<CSSValue> clipValue; RefPtr<CSSValue> positionYValue; + RefPtr<CSSValue> repeatYValue; int i; while (m_valueList->current()) { @@ -1767,6 +1812,8 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addFillValue(values[i], CSSInitialValue::createImplicit()); if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition) addFillValue(positionYValue, CSSInitialValue::createImplicit()); + if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat) + addFillValue(repeatYValue, CSSInitialValue::createImplicit()); if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) && !parsedProperty[i]) { // If background-origin wasn't present, then reset background-clip also. addFillValue(clipValue, CSSInitialValue::createImplicit()); @@ -1789,6 +1836,8 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addFillValue(values[i], val1.release()); if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition) addFillValue(positionYValue, val2.release()); + if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat) + addFillValue(repeatYValue, val2.release()); if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) { // Reparse the value as a clip, and see if we succeed. if (parseFillProperty(CSSPropertyBackgroundClip, propId1, propId2, val1, val2)) @@ -1812,6 +1861,8 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addFillValue(values[i], CSSInitialValue::createImplicit()); if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition) addFillValue(positionYValue, CSSInitialValue::createImplicit()); + if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat) + addFillValue(repeatYValue, CSSInitialValue::createImplicit()); if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) && !parsedProperty[i]) { // If background-origin wasn't present, then reset background-clip also. addFillValue(clipValue, CSSInitialValue::createImplicit()); @@ -1829,6 +1880,14 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addProperty(CSSPropertyWebkitMaskPositionX, values[i].release(), important); // it's OK to call positionYValue.release() since we only see CSSPropertyWebkitMaskPosition once addProperty(CSSPropertyWebkitMaskPositionY, positionYValue.release(), important); + } else if (properties[i] == CSSPropertyBackgroundRepeat) { + addProperty(CSSPropertyBackgroundRepeatX, values[i].release(), important); + // it's OK to call repeatYValue.release() since we only see CSSPropertyBackgroundPosition once + addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release(), important); + } else if (properties[i] == CSSPropertyWebkitMaskRepeat) { + addProperty(CSSPropertyWebkitMaskRepeatX, values[i].release(), important); + // it's OK to call repeatYValue.release() since we only see CSSPropertyBackgroundPosition once + addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release(), important); } else addProperty(properties[i], values[i].release(), important); @@ -2156,7 +2215,7 @@ PassRefPtr<CSSValue> CSSParser::parseAttr(CSSParserValueList* args) if (attrName[0] == '-') return 0; - if (document()->isHTMLDocument()) + if (document() && document()->isHTMLDocument()) attrName = attrName.lower(); return CSSPrimitiveValue::create(attrName, CSSPrimitiveValue::CSS_ATTR); @@ -2269,9 +2328,59 @@ void CSSParser::parseFillPosition(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& va value1.swap(value2); } -PassRefPtr<CSSValue> CSSParser::parseFillSize() +void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2) +{ + CSSParserValue* value = m_valueList->current(); + + int id = m_valueList->current()->id; + if (id == CSSValueRepeatX) { + m_implicitShorthand = true; + value1 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); + value2 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); + m_valueList->next(); + return; + } + if (id == CSSValueRepeatY) { + m_implicitShorthand = true; + value1 = CSSPrimitiveValue::createIdentifier(CSSValueNoRepeat); + value2 = CSSPrimitiveValue::createIdentifier(CSSValueRepeat); + m_valueList->next(); + return; + } + if (id == CSSValueRepeat || id == CSSValueNoRepeat || id == CSSValueRound || id == CSSValueSpace) + value1 = CSSPrimitiveValue::createIdentifier(id); + else { + value1 = 0; + return; + } + + value = m_valueList->next(); + + // First check for the comma. If so, we are finished parsing this value or value pair. + if (value && value->unit == CSSParserValue::Operator && value->iValue == ',') + value = 0; + + if (value) + id = m_valueList->current()->id; + + if (value && (id == CSSValueRepeat || id == CSSValueNoRepeat || id == CSSValueRound || id == CSSValueSpace)) { + value2 = CSSPrimitiveValue::createIdentifier(id); + m_valueList->next(); + } else { + // If only one value was specified, value2 is the same as value1. + m_implicitShorthand = true; + value2 = CSSPrimitiveValue::createIdentifier(static_cast<CSSPrimitiveValue*>(value1.get())->getIdent()); + } +} + +PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma) { + allowComma = true; CSSParserValue* value = m_valueList->current(); + + if (value->id == CSSValueContain || value->id == CSSValueCover) + return CSSPrimitiveValue::createIdentifier(value->id); + RefPtr<CSSPrimitiveValue> parsedValue1; if (value->id == CSSValueAuto) @@ -2286,6 +2395,8 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize() if ((value = m_valueList->next())) { if (value->id == CSSValueAuto) parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); + else if (value->unit == CSSParserValue::Operator && value->iValue == ',') + allowComma = false; else { if (!validUnit(value, FLength|FPercent, m_strict)) return 0; @@ -2316,6 +2427,12 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, } else if (propId == CSSPropertyWebkitMaskPosition) { propId1 = CSSPropertyWebkitMaskPositionX; propId2 = CSSPropertyWebkitMaskPositionY; + } else if (propId == CSSPropertyBackgroundRepeat) { + propId1 = CSSPropertyBackgroundRepeatX; + propId2 = CSSPropertyBackgroundRepeatY; + } else if (propId == CSSPropertyWebkitMaskRepeat) { + propId1 = CSSPropertyWebkitMaskRepeatX; + propId2 = CSSPropertyWebkitMaskRepeatY; } while ((val = m_valueList->current())) { @@ -2328,6 +2445,7 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, m_valueList->next(); allowComma = false; } else { + allowComma = true; switch (propId) { case CSSPropertyBackgroundColor: currValue = parseBackgroundColor(); @@ -2402,17 +2520,16 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, break; case CSSPropertyBackgroundRepeat: case CSSPropertyWebkitMaskRepeat: - if (val->id >= CSSValueRepeat && val->id <= CSSValueNoRepeat) { - currValue = CSSPrimitiveValue::createIdentifier(val->id); - m_valueList->next(); - } + parseFillRepeat(currValue, currValue2); + // parseFillRepeat advances the m_valueList pointer break; - case CSSPropertyWebkitBackgroundSize: - case CSSPropertyWebkitMaskSize: - currValue = parseFillSize(); + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitMaskSize: { + currValue = parseFillSize(allowComma); if (currValue) m_valueList->next(); break; + } } if (!currValue) return false; @@ -2437,7 +2554,6 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, else value2 = currValue2.release(); } - allowComma = true; } // When parsing any fill shorthand property, we let it handle building up the lists for all @@ -3554,7 +3670,7 @@ struct ShadowParseContext { , allowBlur(false) , allowSpread(false) , allowColor(true) - , allowStyle(prop == CSSPropertyBoxShadow) + , allowStyle(prop == CSSPropertyWebkitBoxShadow) , allowBreak(true) { } @@ -3586,7 +3702,7 @@ struct ShadowParseContext { allowY = false; allowBlur = false; allowSpread = false; - allowStyle = property == CSSPropertyBoxShadow; + allowStyle = property == CSSPropertyWebkitBoxShadow; } void commitLength(CSSParserValue* v) @@ -3605,12 +3721,12 @@ struct ShadowParseContext { allowY = false; allowBlur = true; allowColor = true; - allowStyle = property == CSSPropertyBoxShadow; + allowStyle = property == CSSPropertyWebkitBoxShadow; allowBreak = true; } else if (allowBlur) { blur = val.release(); allowBlur = false; - allowSpread = property == CSSPropertyBoxShadow; + allowSpread = property == CSSPropertyWebkitBoxShadow; } else if (allowSpread) { spread = val.release(); allowSpread = false; @@ -3627,7 +3743,7 @@ struct ShadowParseContext { } else { allowBlur = false; allowSpread = false; - allowStyle = property == CSSPropertyBoxShadow; + allowStyle = property == CSSPropertyWebkitBoxShadow; } } @@ -4730,7 +4846,7 @@ UChar* CSSParser::text(int *length) CSSSelector* CSSParser::createFloatingSelector() { - CSSSelector* selector = new CSSSelector; + CSSSelector* selector = fastNew<CSSSelector>(); m_floatingSelectors.add(selector); return selector; } @@ -5126,11 +5242,11 @@ static int cssPropertyID(const UChar* propertyName, unsigned length) const char* const opacity = "opacity"; name = opacity; length = strlen(opacity); - } else if (strcmp(buffer, "-webkit-box-shadow") == 0) { - // CSS Backgrounds/Borders. -webkit-box-shadow worked in Safari 4 and earlier. - const char* const boxShadow = "box-shadow"; - name = boxShadow; - length = strlen(boxShadow); + } else if (strcmp(buffer, "-webkit-background-size") == 0) { + // CSS Backgrounds/Borders. -webkit-background-size worked in Safari 4 and earlier. + const char* const backgroundSize = "background-size"; + name = backgroundSize; + length = strlen(backgroundSize); } else if (hasPrefix(buffer + 7, length - 7, "-border-")) { // -webkit-border-*-*-radius worked in Safari 4 and earlier. -webkit-border-radius syntax // differs from border-radius, so it is remains as a distinct property. diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index 5a2b283..1a156da 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -82,7 +82,8 @@ namespace WebCore { bool parseFillImage(RefPtr<CSSValue>&); PassRefPtr<CSSValue> parseFillPositionXY(bool& xFound, bool& yFound); void parseFillPosition(RefPtr<CSSValue>&, RefPtr<CSSValue>&); - PassRefPtr<CSSValue> parseFillSize(); + void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&); + PassRefPtr<CSSValue> parseFillSize(bool &allowComma); bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&); bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important); diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp index 6343dac..1f2c9ca 100644 --- a/WebCore/css/CSSPrimitiveValue.cpp +++ b/WebCore/css/CSSPrimitiveValue.cpp @@ -643,7 +643,7 @@ Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const return m_value.rect; } -RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const +PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const { ec = 0; if (m_type != CSS_RGBCOLOR) { @@ -652,7 +652,7 @@ RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const } // FIMXE: This should not return a new object for each invocation. - return RGBColor::create(m_value.rgbcolor).releaseRef(); + return RGBColor::create(m_value.rgbcolor); } Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h index 85a0ba3..d417619 100644 --- a/WebCore/css/CSSPrimitiveValue.h +++ b/WebCore/css/CSSPrimitiveValue.h @@ -152,7 +152,7 @@ public: Rect* getRectValue(ExceptionCode&) const; Rect* getRectValue() const { return m_type != CSS_RECT ? 0 : m_value.rect; } - RGBColor* getRGBColorValue(ExceptionCode&) const; + PassRefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const; RGBA32 getRGBA32Value() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; } Pair* getPairValue(ExceptionCode&) const; diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 69cfbb1..3616aa5 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,11 +30,13 @@ #include "CSSPrimitiveValue.h" #include "CSSValueKeywords.h" +#include "FontSmoothingMode.h" #include "GraphicsTypes.h" #include "Path.h" #include "RenderStyleConstants.h" #include "SVGRenderStyleDefs.h" #include "TextDirection.h" +#include "TextRenderingMode.h" #include "ThemeTypes.h" namespace WebCore { @@ -197,6 +200,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case ListboxPart: m_value.ident = CSSValueListbox; break; +#if ENABLE(DATALIST) + case ListButtonPart: + m_value.ident = CSSValueListButton; + break; +#endif case ListItemPart: m_value.ident = CSSValueListitem; break; @@ -227,6 +235,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MediaSliderThumbPart: m_value.ident = CSSValueMediaSliderthumb; break; + case MediaVolumeSliderContainerPart: + m_value.ident = CSSValueMediaVolumeSliderContainer; + break; + case MediaVolumeSliderPart: + m_value.ident = CSSValueMediaVolumeSlider; + break; + case MediaVolumeSliderThumbPart: + m_value.ident = CSSValueMediaVolumeSliderthumb; + break; case MediaControlsBackgroundPart: m_value.ident = CSSValueMediaControlsBackground; break; @@ -375,15 +392,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e) case RepeatFill: m_value.ident = CSSValueRepeat; break; - case RepeatXFill: - m_value.ident = CSSValueRepeatX; - break; - case RepeatYFill: - m_value.ident = CSSValueRepeatY; - break; case NoRepeatFill: m_value.ident = CSSValueNoRepeat; break; + case RoundFill: + m_value.ident = CSSValueRound; + break; + case SpaceFill: + m_value.ident = CSSValueSpace; + break; } } @@ -392,12 +409,12 @@ template<> inline CSSPrimitiveValue::operator EFillRepeat() const switch (m_value.ident) { case CSSValueRepeat: return RepeatFill; - case CSSValueRepeatX: - return RepeatXFill; - case CSSValueRepeatY: - return RepeatYFill; case CSSValueNoRepeat: return NoRepeatFill; + case CSSValueRound: + return RoundFill; + case CSSValueSpace: + return SpaceFill; default: ASSERT_NOT_REACHED(); return RepeatFill; @@ -522,6 +539,7 @@ template<> inline CSSPrimitiveValue::operator EBoxOrient() const case CSSValueInlineAxis: return HORIZONTAL; case CSSValueVertical: + case CSSValueBlockAxis: return VERTICAL; default: ASSERT_NOT_REACHED(); @@ -777,6 +795,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e) case TABLE_CAPTION: m_value.ident = CSSValueTableCaption; break; +#if ENABLE(WCSS) + case WAP_MARQUEE: + m_value.ident = CSSValueWapMarquee; + break; +#endif case BOX: m_value.ident = CSSValueWebkitBox; break; @@ -1782,6 +1805,81 @@ template<> inline CSSPrimitiveValue::operator EPointerEvents() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing) + : m_type(CSS_IDENT) +{ + switch (smoothing) { + case AutoSmoothing: + m_value.ident = CSSValueAuto; + return; + case NoSmoothing: + m_value.ident = CSSValueNone; + return; + case Antialiased: + m_value.ident = CSSValueAntialiased; + return; + case SubpixelAntialiased: + m_value.ident = CSSValueSubpixelAntialiased; + return; + } + + ASSERT_NOT_REACHED(); + m_value.ident = CSSValueAuto; +} + +template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const +{ + switch (m_value.ident) { + case CSSValueAuto: + return AutoSmoothing; + case CSSValueNone: + return NoSmoothing; + case CSSValueAntialiased: + return Antialiased; + case CSSValueSubpixelAntialiased: + return SubpixelAntialiased; + } + + ASSERT_NOT_REACHED(); + return AutoSmoothing; +} + +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e) + : m_type(CSS_IDENT) +{ + switch (e) { + case AutoTextRendering: + m_value.ident = CSSValueAuto; + break; + case OptimizeSpeed: + m_value.ident = CSSValueOptimizespeed; + break; + case OptimizeLegibility: + m_value.ident = CSSValueOptimizelegibility; + break; + case GeometricPrecision: + m_value.ident = CSSValueGeometricprecision; + break; + } +} + +template<> inline CSSPrimitiveValue::operator TextRenderingMode() const +{ + switch (m_value.ident) { + case CSSValueAuto: + return AutoTextRendering; + case CSSValueOptimizespeed: + return OptimizeSpeed; + case CSSValueOptimizelegibility: + return OptimizeLegibility; + case CSSValueGeometricprecision: + return GeometricPrecision; + default: + ASSERT_NOT_REACHED(); + return AutoTextRendering; + } +} + #if ENABLE(SVG) template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e) @@ -2185,42 +2283,6 @@ template<> inline CSSPrimitiveValue::operator ETextAnchor() const } } -template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextRendering e) - : m_type(CSS_IDENT) -{ - switch (e) { - case TR_AUTO: - m_value.ident = CSSValueAuto; - break; - case TR_OPTIMIZESPEED: - m_value.ident = CSSValueOptimizespeed; - break; - case TR_OPTIMIZELEGIBILITY: - m_value.ident = CSSValueOptimizelegibility; - break; - case TR_GEOMETRICPRECISION: - m_value.ident = CSSValueGeometricprecision; - break; - } -} - -template<> inline CSSPrimitiveValue::operator ETextRendering() const -{ - switch (m_value.ident) { - case CSSValueAuto: - return TR_AUTO; - case CSSValueOptimizespeed: - return TR_OPTIMIZESPEED; - case CSSValueOptimizelegibility: - return TR_OPTIMIZELEGIBILITY; - case CSSValueGeometricprecision: - return TR_GEOMETRICPRECISION; - default: - ASSERT_NOT_REACHED(); - return TR_AUTO; - } -} - template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e) : m_type(CSS_IDENT) { diff --git a/WebCore/css/CSSPropertyLonghand.cpp b/WebCore/css/CSSPropertyLonghand.cpp index b15f31e..b45fa0d 100644 --- a/WebCore/css/CSSPropertyLonghand.cpp +++ b/WebCore/css/CSSPropertyLonghand.cpp @@ -77,6 +77,9 @@ static void initShorthandMap(ShorthandMap& shorthandMap) static const int backgroundPositionProperties[] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBackgroundPosition, backgroundPositionProperties); + static const int backgroundRepeatProperties[] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; + SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBackgroundRepeat, backgroundRepeatProperties); + static const int borderSpacingProperties[] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBorderSpacing, borderSpacingProperties); @@ -134,7 +137,8 @@ static void initShorthandMap(ShorthandMap& shorthandMap) CSSPropertyBackgroundOrigin, CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY, - CSSPropertyBackgroundRepeat, + CSSPropertyBackgroundRepeatX, + CSSPropertyBackgroundRepeatY }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBackground, backgroundProperties); @@ -163,6 +167,9 @@ static void initShorthandMap(ShorthandMap& shorthandMap) static const int maskPositionProperties[] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitMaskPosition, maskPositionProperties); + static const int maskRepeatProperties[] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY }; + SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitMaskRepeat, maskRepeatProperties); + static const int maskProperties[] = { CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskClip, @@ -170,7 +177,8 @@ static void initShorthandMap(ShorthandMap& shorthandMap) CSSPropertyWebkitMaskOrigin, CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY, - CSSPropertyWebkitMaskRepeat, + CSSPropertyWebkitMaskRepeatX, + CSSPropertyWebkitMaskRepeatY }; SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitMask, maskProperties); diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index 40e456f..7bed755 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -18,6 +18,9 @@ background-position background-position-x background-position-y background-repeat +background-repeat-x +background-repeat-y +background-size border border-bottom border-bottom-color @@ -46,7 +49,6 @@ border-top-style border-top-width border-width bottom -box-shadow caption-side clear clip @@ -124,6 +126,7 @@ text-overline-color text-overline-mode text-overline-style text-overline-width +text-rendering text-shadow text-transform text-underline @@ -157,7 +160,6 @@ zoom -webkit-background-clip -webkit-background-composite -webkit-background-origin --webkit-background-size -webkit-binding -webkit-border-fit -webkit-border-horizontal-spacing @@ -177,6 +179,7 @@ zoom -webkit-box-orient -webkit-box-pack -webkit-box-reflect +-webkit-box-shadow -webkit-box-sizing -webkit-column-break-after -webkit-column-break-before @@ -190,6 +193,7 @@ zoom -webkit-column-width -webkit-columns -webkit-font-size-delta +-webkit-font-smoothing -webkit-highlight -webkit-line-break -webkit-line-clamp @@ -214,6 +218,8 @@ zoom -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat +-webkit-mask-repeat-x +-webkit-mask-repeat-y -webkit-mask-size -webkit-match-nearest-mail-blockquote-color -webkit-nbsp-mode diff --git a/WebCore/css/CSSRuleList.idl b/WebCore/css/CSSRuleList.idl index 224d6a1..9add078 100644 --- a/WebCore/css/CSSRuleList.idl +++ b/WebCore/css/CSSRuleList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +27,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, InterfaceUUID=64c346a0-1e34-49d3-9472-57ec8e0fdccb, diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 80910a7..313528f 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -77,9 +77,12 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, before, ("before")); DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button")); + DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only")); DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write")); + DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid")); + DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid")); DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag")); DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag")); // was documented with this name in Apple documentation, so keep an alia DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty")); @@ -96,6 +99,9 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus")); DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover")); DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate")); +#if ENABLE(DATALIST) + DEFINE_STATIC_LOCAL(AtomicString, inputListButton, ("-webkit-input-list-button")); +#endif DEFINE_STATIC_LOCAL(AtomicString, inputPlaceholder, ("-webkit-input-placeholder")); DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child")); DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type")); @@ -105,6 +111,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, mediaControlsMuteButton, ("-webkit-media-controls-mute-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPlayButton, ("-webkit-media-controls-play-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline")); + DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSlider, ("-webkit-media-controls-volume-slider")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button")); @@ -112,6 +119,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container")); + DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSliderContainer, ("-webkit-media-controls-volume-slider-container")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsCurrentTimeDisplay, ("-webkit-media-controls-current-time-display")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeRemainingDisplay, ("-webkit-media-controls-time-remaining-display")); DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not(")); @@ -170,12 +178,18 @@ void CSSSelector::extractPseudoType() const else if (m_value == fileUploadButton) { m_pseudoType = PseudoFileUploadButton; element = true; - } else if (m_value == disabled) + } else if (m_value == defaultString) + m_pseudoType = PseudoDefault; + else if (m_value == disabled) m_pseudoType = PseudoDisabled; else if (m_value == readOnly) m_pseudoType = PseudoReadOnly; else if (m_value == readWrite) m_pseudoType = PseudoReadWrite; + else if (m_value == valid) + m_pseudoType = PseudoValid; + else if (m_value == invalid) + m_pseudoType = PseudoInvalid; else if (m_value == drag || m_value == dragAlias) m_pseudoType = PseudoDrag; else if (m_value == enabled) @@ -186,7 +200,14 @@ void CSSSelector::extractPseudoType() const m_pseudoType = PseudoFirstChild; else if (m_value == fullPageMedia) m_pseudoType = PseudoFullPageMedia; - else if (m_value == inputPlaceholder) { + else +#if ENABLE(DATALIST) + if (m_value == inputListButton) { + m_pseudoType = PseudoInputListButton; + element = true; + } else +#endif + if (m_value == inputPlaceholder) { m_pseudoType = PseudoInputPlaceholder; element = true; } else if (m_value == lastChild) @@ -235,6 +256,9 @@ void CSSSelector::extractPseudoType() const } else if (m_value == mediaControlsTimeline) { m_pseudoType = PseudoMediaControlsTimeline; element = true; + } else if (m_value == mediaControlsVolumeSlider) { + m_pseudoType = PseudoMediaControlsVolumeSlider; + element = true; } else if (m_value == mediaControlsSeekBackButton) { m_pseudoType = PseudoMediaControlsSeekBackButton; element = true; @@ -256,6 +280,9 @@ void CSSSelector::extractPseudoType() const } else if (m_value == mediaControlsTimelineContainer) { m_pseudoType = PseudoMediaControlsTimelineContainer; element = true; + } else if (m_value == mediaControlsVolumeSliderContainer) { + m_pseudoType = PseudoMediaControlsVolumeSliderContainer; + element = true; } else if (m_value == notStr) m_pseudoType = PseudoNot; else if (m_value == nthChild) diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 18251fd..0c3b677 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -126,12 +126,15 @@ namespace WebCore { PseudoChecked, PseudoEnabled, PseudoFullPageMedia, + PseudoDefault, PseudoDisabled, PseudoInputPlaceholder, PseudoOptional, PseudoRequired, PseudoReadOnly, PseudoReadWrite, + PseudoValid, + PseudoInvalid, PseudoIndeterminate, PseudoTarget, PseudoBefore, @@ -170,15 +173,18 @@ namespace WebCore { PseudoMediaControlsMuteButton, PseudoMediaControlsPlayButton, PseudoMediaControlsTimelineContainer, + PseudoMediaControlsVolumeSliderContainer, PseudoMediaControlsCurrentTimeDisplay, PseudoMediaControlsTimeRemainingDisplay, PseudoMediaControlsTimeline, + PseudoMediaControlsVolumeSlider, PseudoMediaControlsSeekBackButton, PseudoMediaControlsSeekForwardButton, PseudoMediaControlsRewindButton, PseudoMediaControlsReturnToRealtimeButton, PseudoMediaControlsStatusDisplay, - PseudoMediaControlsFullscreenButton + PseudoMediaControlsFullscreenButton, + PseudoInputListButton }; PseudoType pseudoType() const diff --git a/WebCore/css/CSSSelectorList.cpp b/WebCore/css/CSSSelectorList.cpp index 5ad3809..7f82ca4 100644 --- a/WebCore/css/CSSSelectorList.cpp +++ b/WebCore/css/CSSSelectorList.cpp @@ -55,11 +55,9 @@ void CSSSelectorList::adoptSelectorVector(Vector<CSSSelector*>& selectorVector) m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * selectorVector.size())); for (size_t i = 0; i < size; ++i) { memcpy(&m_selectorArray[i], selectorVector[i], sizeof(CSSSelector)); - // We want to free the memory (which was allocated with new), but we - // don't want the destructor to run since it will affect the copy - // we've just made. In theory this is undefined, but operator delete - // is only defined taking a void*, so in practice it should be ok. - delete reinterpret_cast<char*>(selectorVector[i]); + // We want to free the memory (which was allocated with fastNew), but we + // don't want the destructor to run since it will affect the copy we've just made. + fastDeleteSkippingDestructor(selectorVector[i]); ASSERT(!m_selectorArray[i].isLastInSelectorList()); } m_selectorArray[size - 1].setLastInSelectorList(); @@ -91,4 +89,51 @@ void CSSSelectorList::deleteSelectors() } } + +template <typename Functor> +static bool forEachTagSelector(Functor& functor, CSSSelector* selector) +{ + ASSERT(selector); + + do { + if (functor(selector)) + return true; + if (CSSSelector* simpleSelector = selector->simpleSelector()) { + if (forEachTagSelector(functor, simpleSelector)) + return true; + } + } while ((selector = selector->tagHistory())); + + return false; +} + +template <typename Functor> +static bool forEachSelector(Functor& functor, const CSSSelectorList* selectorList) +{ + for (CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(selector)) { + if (forEachTagSelector(functor, selector)) + return true; + } + + return false; +} + +class SelectorNeedsNamespaceResolutionFunctor { +public: + bool operator()(CSSSelector* selector) + { + if (selector->hasTag() && selector->m_tag.prefix() != nullAtom && selector->m_tag.prefix() != starAtom) + return true; + if (selector->hasAttribute() && selector->attribute().prefix() != nullAtom && selector->attribute().prefix() != starAtom) + return true; + return false; + } +}; + +bool CSSSelectorList::selectorsNeedNamespaceResolution() +{ + SelectorNeedsNamespaceResolutionFunctor functor; + return forEachSelector(functor, this); } + +} // namespace WebCore diff --git a/WebCore/css/CSSSelectorList.h b/WebCore/css/CSSSelectorList.h index 3518139..9e40ef8 100644 --- a/WebCore/css/CSSSelectorList.h +++ b/WebCore/css/CSSSelectorList.h @@ -31,25 +31,27 @@ namespace WebCore { - class CSSSelectorList : public Noncopyable { - public: - CSSSelectorList() : m_selectorArray(0) { } - ~CSSSelectorList(); - - void adopt(CSSSelectorList& list); - void adoptSelectorVector(Vector<CSSSelector*>& selectorVector); - - CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; } - static CSSSelector* next(CSSSelector* previous) { return previous->isLastInSelectorList() ? 0 : previous + 1; } - bool hasOneSelector() const { return m_selectorArray ? m_selectorArray->isLastInSelectorList() : false; } - - private: - void deleteSelectors(); - - // End of the array is indicated by m_isLastInSelectorList bit in the last item. - CSSSelector* m_selectorArray; - }; - -} - -#endif +class CSSSelectorList : public Noncopyable { +public: + CSSSelectorList() : m_selectorArray(0) { } + ~CSSSelectorList(); + + void adopt(CSSSelectorList& list); + void adoptSelectorVector(Vector<CSSSelector*>& selectorVector); + + CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; } + static CSSSelector* next(CSSSelector* previous) { return previous->isLastInSelectorList() ? 0 : previous + 1; } + bool hasOneSelector() const { return m_selectorArray ? m_selectorArray->isLastInSelectorList() : false; } + + bool selectorsNeedNamespaceResolution(); + +private: + void deleteSelectors(); + + // End of the array is indicated by m_isLastInSelectorList bit in the last item. + CSSSelector* m_selectorArray; +}; + +} // namespace WebCore + +#endif // CSSSelectorList_h diff --git a/WebCore/css/CSSStyleDeclaration.idl b/WebCore/css/CSSStyleDeclaration.idl index f7ce37f..3e37418 100644 --- a/WebCore/css/CSSStyleDeclaration.idl +++ b/WebCore/css/CSSStyleDeclaration.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, DelegatingPutFunction, HasNameGetter, diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 9074476..69c5598 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -408,7 +408,9 @@ static const MediaQueryEvaluator& printEval() return staticPrintEval; } -CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet, bool strictParsing, bool matchAuthorAndUserStyles) +CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet, + CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets, + bool strictParsing, bool matchAuthorAndUserStyles) : m_backgroundData(BackgroundFillLayer) , m_checker(doc, strictParsing) , m_fontSelector(CSSFontSelector::create(doc)) @@ -449,12 +451,15 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet, } // FIXME: This sucks! The user sheet is reparsed every time! - if (!userStyleSheet.isEmpty()) { - m_userSheet = CSSStyleSheet::create(doc); - m_userSheet->parseString(userStyleSheet, strictParsing); - + if (pageUserSheet || pageGroupUserSheets) { m_userStyle = new CSSRuleSet(); - m_userStyle->addRulesFromSheet(m_userSheet.get(), *m_medium, this); + if (pageUserSheet) + m_userStyle->addRulesFromSheet(pageUserSheet, *m_medium, this); + if (pageGroupUserSheets) { + unsigned length = pageGroupUserSheets->size(); + for (unsigned i = 0; i < length; i++) + m_userStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this); + } } // add stylesheets from document @@ -995,6 +1000,13 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) if (s->isEnabledFormControl() != m_element->isEnabledFormControl()) return false; + + if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm()) + return false; + + if ((s->willValidate() && s->isValidFormControlElement()) != + (m_element->willValidate() && m_element->isValidFormControlElement())) + return false; } if (style->transitions() || style->animations()) @@ -1127,6 +1139,17 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } #endif +#if ENABLE(MATHML) + static bool loadedMathMLUserAgentSheet; + if (e->isMathMLElement() && !loadedMathMLUserAgentSheet) { + // MathML rules. + loadedMathMLUserAgentSheet = true; + CSSStyleSheet* mathMLSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet)); + defaultStyle->addRulesFromSheet(mathMLSheet, screenEval()); + defaultPrintStyle->addRulesFromSheet(mathMLSheet, printEval()); + } +#endif + #if ENABLE(WML) static bool loadedWMLUserAgentSheet; if (e->isWMLElement() && !loadedWMLUserAgentSheet) { @@ -2358,6 +2381,8 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoFullPageMedia: return e && e->document() && e->document()->isMediaDocument(); break; + case CSSSelector::PseudoDefault: + return e && e->isDefaultButtonForForm(); case CSSSelector::PseudoDisabled: if (e && e->isFormControlElement()) { InputElement* inputElement = toInputElement(e); @@ -2384,6 +2409,10 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme return e && e->isOptionalFormControl(); case CSSSelector::PseudoRequired: return e && e->isRequiredFormControl(); + case CSSSelector::PseudoValid: + return e && e->willValidate() && e->isValidFormControlElement(); + case CSSSelector::PseudoInvalid: + return e && e->willValidate() && !e->isValidFormControlElement(); case CSSSelector::PseudoChecked: { if (!e || !e->isFormControlElement()) break; @@ -2465,6 +2494,11 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoFileUploadButton: dynamicPseudo = FILE_UPLOAD_BUTTON; return true; +#if ENABLE(DATALIST) + case CSSSelector::PseudoInputListButton: + dynamicPseudo = INPUT_LIST_BUTTON; + return true; +#endif case CSSSelector::PseudoInputPlaceholder: dynamicPseudo = INPUT_PLACEHOLDER; return true; @@ -2494,7 +2528,10 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme return true; case CSSSelector::PseudoMediaControlsTimelineContainer: dynamicPseudo = MEDIA_CONTROLS_TIMELINE_CONTAINER; - return true; + return true; + case CSSSelector::PseudoMediaControlsVolumeSliderContainer: + dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER; + return true; case CSSSelector::PseudoMediaControlsCurrentTimeDisplay: dynamicPseudo = MEDIA_CONTROLS_CURRENT_TIME_DISPLAY; return true; @@ -2504,6 +2541,9 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoMediaControlsTimeline: dynamicPseudo = MEDIA_CONTROLS_TIMELINE; return true; + case CSSSelector::PseudoMediaControlsVolumeSlider: + dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER; + return true; case CSSSelector::PseudoMediaControlsSeekBackButton: dynamicPseudo = MEDIA_CONTROLS_SEEK_BACK_BUTTON; return true; @@ -2920,10 +2960,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitBackgroundOrigin: HANDLE_BACKGROUND_VALUE(origin, Origin, value) return; - case CSSPropertyBackgroundRepeat: - HANDLE_BACKGROUND_VALUE(repeat, Repeat, value) - return; - case CSSPropertyWebkitBackgroundSize: + case CSSPropertyBackgroundSize: HANDLE_BACKGROUND_VALUE(size, Size, value) return; case CSSPropertyWebkitMaskAttachment: @@ -2938,9 +2975,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitMaskOrigin: HANDLE_MASK_VALUE(origin, Origin, value) return; - case CSSPropertyWebkitMaskRepeat: - HANDLE_MASK_VALUE(repeat, Repeat, value) - return; case CSSPropertyWebkitMaskSize: HANDLE_MASK_VALUE(size, Size, value) return; @@ -2991,6 +3025,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; case CSSPropertyDisplay: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display) +#if ENABLE(WCSS) + if (primitiveValue) { + if (primitiveValue->getIdent() == CSSValueWapMarquee) { + // Initialize Wap Marquee style + m_style->setOverflowX(OMARQUEE); + m_style->setOverflowY(OMARQUEE); + m_style->setWhiteSpace(NOWRAP); + m_style->setMarqueeDirection(MLEFT); + m_style->setMarqueeSpeed(85); // Normal speed + m_style->setMarqueeLoopCount(1); + m_style->setMarqueeBehavior(MSCROLL); + + if (m_parentStyle) + m_style->setDisplay(m_parentStyle->display()); + else + m_style->setDisplay(*primitiveValue); + } else + m_style->setDisplay(*primitiveValue); + } +#endif return; case CSSPropertyEmptyCells: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells) @@ -3207,6 +3261,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) 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()); @@ -3437,6 +3511,41 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } + case CSSPropertyWebkitFontSmoothing: { + FontDescription fontDescription = m_style->fontDescription(); + if (isInherit) + fontDescription.setFontSmoothing(m_parentStyle->fontDescription().fontSmoothing()); + else if (isInitial) + fontDescription.setFontSmoothing(AutoSmoothing); + else { + if (!primitiveValue) + return; + int id = primitiveValue->getIdent(); + FontSmoothingMode smoothing; + switch (id) { + case CSSValueAuto: + smoothing = AutoSmoothing; + break; + case CSSValueNone: + smoothing = NoSmoothing; + break; + case CSSValueAntialiased: + smoothing = Antialiased; + break; + case CSSValueSubpixelAntialiased: + smoothing = SubpixelAntialiased; + break; + default: + ASSERT_NOT_REACHED(); + smoothing = AutoSmoothing; + } + fontDescription.setFontSmoothing(smoothing); + } + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + return; + } + case CSSPropertyLetterSpacing: case CSSPropertyWordSpacing: { @@ -3754,7 +3863,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) { FontDescription fontDescription = m_style->fontDescription(); fontDescription.setKeywordSize(0); - bool familyIsFixed = fontDescription.genericFamily() == FontDescription::MonospaceFamily; float oldSize = 0; float size = 0; @@ -3769,7 +3877,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_parentNode) fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize()); } else if (isInitial) { - size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); } else if (primitiveValue->getIdent()) { // Keywords are being used. @@ -3782,7 +3890,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSValueXLarge: case CSSValueXxLarge: case CSSValueWebkitXxxLarge: - size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1); break; case CSSValueLarger: @@ -4025,13 +4133,12 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; return; - } - else if (isInitial) { + } else if (isInitial) { FontDescription initialDesc = FontDescription(); FontDescription fontDescription = m_style->fontDescription(); // We need to adjust the size to account for the generic family change from monospace // to non-monospace. - if (fontDescription.keywordSize() && fontDescription.genericFamily() == FontDescription::MonospaceFamily) + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize()) setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false)); fontDescription.setGenericFamily(initialDesc.genericFamily()); if (!initialDesc.firstFamily().familyIsEmpty()) @@ -4041,21 +4148,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } - if (!value->isValueList()) return; + if (!value->isValueList()) + return; FontDescription fontDescription = m_style->fontDescription(); - CSSValueList *list = static_cast<CSSValueList*>(value); + CSSValueList* list = static_cast<CSSValueList*>(value); int len = list->length(); FontFamily& firstFamily = fontDescription.firstFamily(); - FontFamily *currFamily = 0; + FontFamily* currFamily = 0; // Before mapping in a new font-family property, we should reset the generic family. - bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily; + bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize(); fontDescription.setGenericFamily(FontDescription::NoFamily); for (int i = 0; i < len; i++) { - CSSValue *item = list->itemWithoutBoundsCheck(i); - if (!item->isPrimitiveValue()) continue; - CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item); + CSSValue* item = list->itemWithoutBoundsCheck(i); + if (!item->isPrimitiveValue()) + continue; + CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item); AtomicString face; Settings* settings = m_checker.m_document->settings(); if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING) @@ -4087,28 +4196,32 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) break; } } - + if (!face.isEmpty()) { if (!currFamily) { // Filling in the first family. firstFamily.setFamily(face); + firstFamily.appendFamily(0); // Remove any inherited family-fallback list. currFamily = &firstFamily; - } - else { + } else { RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); newFamily->setFamily(face); currFamily->appendFamily(newFamily); currFamily = newFamily.get(); } - - if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace) - setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace)); - - if (m_style->setFontDescription(fontDescription)) - m_fontDirty = true; } } - return; + + // We can't call useFixedDefaultSize() until all new font families have been added + // If currFamily is non-zero then we set at least one family on this description. + if (currFamily) { + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) + setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize)); + + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + } + return; } case CSSPropertyTextDecoration: { // list of ident @@ -4526,9 +4639,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) HANDLE_INHERIT_AND_INITIAL(outlineOffset, OutlineOffset) m_style->setOutlineOffset(primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor)); return; - + case CSSPropertyTextRendering: { + FontDescription fontDescription = m_style->fontDescription(); + if (isInherit) + fontDescription.setTextRenderingMode(m_parentStyle->fontDescription().textRenderingMode()); + else if (isInitial) + fontDescription.setTextRenderingMode(AutoTextRendering); + else { + if (!primitiveValue) + return; + fontDescription.setTextRenderingMode(*primitiveValue); + } + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + return; + } case CSSPropertyTextShadow: - case CSSPropertyBoxShadow: { + case CSSPropertyWebkitBoxShadow: { if (isInherit) { if (id == CSSPropertyTextShadow) return m_style->setTextShadow(m_parentStyle->textShadow() ? new ShadowData(*m_parentStyle->textShadow()) : 0); @@ -4742,6 +4869,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount()); m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior()); return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeLoop: +#endif case CSSPropertyWebkitMarqueeRepetition: { HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount) if (!primitiveValue) @@ -4752,6 +4882,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(primitiveValue->getIntValue()); return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeSpeed: +#endif case CSSPropertyWebkitMarqueeSpeed: { HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed) if (!primitiveValue) @@ -4802,9 +4935,30 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeStyle: +#endif case CSSPropertyWebkitMarqueeStyle: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior) return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection) + if (primitiveValue && primitiveValue->getIdent()) { + switch (primitiveValue->getIdent()) { + case CSSValueLtr: + m_style->setMarqueeDirection(MRIGHT); + break; + case CSSValueRtl: + m_style->setMarqueeDirection(MLEFT); + break; + default: + m_style->setMarqueeDirection(*primitiveValue); + break; + } + } + return; +#endif case CSSPropertyWebkitMarqueeDirection: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection) return; @@ -5246,10 +5400,10 @@ void CSSStyleSelector::mapFillImage(FillLayer* layer, CSSValue* value) layer->setImage(styleImage(value)); } -void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value) +void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value) { if (value->cssValueType() == CSSValue::CSS_INITIAL) { - layer->setRepeat(FillLayer::initialFillRepeat(layer->type())); + layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type())); return; } @@ -5257,22 +5411,46 @@ void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value) return; CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setRepeat(*primitiveValue); + layer->setRepeatX(*primitiveValue); } -void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value) +void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value) { - LengthSize b = FillLayer::initialFillSize(layer->type()); - if (value->cssValueType() == CSSValue::CSS_INITIAL) { - layer->setSize(b); + layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type())); return; } if (!value->isPrimitiveValue()) return; - + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setRepeatY(*primitiveValue); +} + +void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value) +{ + if (!value->isPrimitiveValue()) { + layer->setSizeType(SizeNone); + return; + } + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->getIdent() == CSSValueContain) + layer->setSizeType(Contain); + else if (primitiveValue->getIdent() == CSSValueCover) + layer->setSizeType(Cover); + else + layer->setSizeType(SizeLength); + + LengthSize b = FillLayer::initialFillSizeLength(layer->type()); + + if (value->cssValueType() == CSSValue::CSS_INITIAL || primitiveValue->getIdent() == CSSValueContain + || primitiveValue->getIdent() == CSSValueCover) { + layer->setSizeLength(b); + return; + } + Pair* pair = primitiveValue->getPairValue(); if (!pair) return; @@ -5309,7 +5487,7 @@ void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value) b.setWidth(firstLength); b.setHeight(secondLength); - layer->setSize(b); + layer->setSizeLength(b); } void CSSStyleSelector::mapFillXPosition(FillLayer* layer, CSSValue* value) @@ -5587,8 +5765,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty return; const FontDescription& parentFont = parentStyle->fontDescription(); - - if (childFont.genericFamily() == parentFont.genericFamily()) + if (childFont.useFixedDefaultSize() == parentFont.useFixedDefaultSize()) return; // For now, lump all families but monospace together. @@ -5601,17 +5778,16 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty // If the font uses a keyword size, then we refetch from the table rather than // multiplying by our scale factor. float size; - if (childFont.keywordSize()) { - size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), - childFont.genericFamily() == FontDescription::MonospaceFamily); - } else { + if (childFont.keywordSize()) + size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize()); + else { Settings* settings = m_checker.m_document->settings(); float fixedScaleFactor = settings ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize() : 1; - size = (parentFont.genericFamily() == FontDescription::MonospaceFamily) ? - childFont.specifiedSize()/fixedScaleFactor : - childFont.specifiedSize()*fixedScaleFactor; + size = parentFont.useFixedDefaultSize() ? + childFont.specifiedSize() / fixedScaleFactor : + childFont.specifiedSize() * fixedScaleFactor; } FontDescription newFontDescription(childFont); diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index 668c6c3..6e0663f 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -80,7 +80,9 @@ public: // This class selects a RenderStyle for a given element based on a collection of stylesheets. class CSSStyleSelector : public Noncopyable { public: - CSSStyleSelector(Document*, const String& userStyleSheet, StyleSheetList*, CSSStyleSheet*, bool strictParsing, bool matchAuthorAndUserStyles); + CSSStyleSelector(Document*, StyleSheetList* authorSheets, CSSStyleSheet* mappedElementSheet, + CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets, + bool strictParsing, bool matchAuthorAndUserStyles); ~CSSStyleSelector(); void initElementAndPseudoState(Element*); @@ -175,7 +177,6 @@ public: CSSRuleSet* m_authorStyle; CSSRuleSet* m_userStyle; - RefPtr<CSSStyleSheet> m_userSheet; bool m_hasUAAppearance; BorderData m_borderData; @@ -223,7 +224,8 @@ public: void mapFillComposite(FillLayer*, CSSValue*); void mapFillOrigin(FillLayer*, CSSValue*); void mapFillImage(FillLayer*, CSSValue*); - void mapFillRepeat(FillLayer*, CSSValue*); + void mapFillRepeatX(FillLayer*, CSSValue*); + void mapFillRepeatY(FillLayer*, CSSValue*); void mapFillSize(FillLayer*, CSSValue*); void mapFillXPosition(FillLayer*, CSSValue*); void mapFillYPosition(FillLayer*, CSSValue*); diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index ce50af6..1579999 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -40,20 +40,22 @@ CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, con , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(!parentSheet || parentSheet->useStrictParsing()) + , m_isUserStyleSheet(parentSheet ? parentSheet->isUserStyleSheet() : false) { } -CSSStyleSheet::CSSStyleSheet(Node *parentNode, const String& href, const String& charset) +CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const String& charset) : StyleSheet(parentNode, href) , m_doc(parentNode->document()) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(false) + , m_isUserStyleSheet(false) { } -CSSStyleSheet::CSSStyleSheet(CSSRule *ownerRule, const String& href, const String& charset) +CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset) : StyleSheet(ownerRule, href) , m_namespaces(0) , m_charset(charset) @@ -62,6 +64,7 @@ CSSStyleSheet::CSSStyleSheet(CSSRule *ownerRule, const String& href, const Strin { CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0; m_doc = parentSheet ? parentSheet->doc() : 0; + m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false; } CSSStyleSheet::~CSSStyleSheet() diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h index 8646ee9..f534104 100644 --- a/WebCore/css/CSSStyleSheet.h +++ b/WebCore/css/CSSStyleSheet.h @@ -93,6 +93,9 @@ public: void setStrictParsing(bool b) { m_strictParsing = b; } bool useStrictParsing() const { return m_strictParsing; } + void setIsUserStyleSheet(bool b) { m_isUserStyleSheet = b; } + bool isUserStyleSheet() const { return m_isUserStyleSheet; } + private: CSSStyleSheet(Node* ownerNode, const String& href, const String& charset); CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset); @@ -106,6 +109,7 @@ private: String m_charset; bool m_loadCompleted : 1; bool m_strictParsing : 1; + bool m_isUserStyleSheet : 1; }; } // namespace diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index c0b52f2..1b7b1d8 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -169,6 +169,8 @@ repeat repeat-x repeat-y no-repeat +# round +# space # # CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE: # @@ -260,6 +262,7 @@ table-cell table-caption -webkit-box -webkit-inline-box +-wap-marquee #none # # CSS_PROP_CURSOR: @@ -498,6 +501,7 @@ square-button button button-bevel default-button +list-button listbox listitem media-fullscreen-button @@ -509,6 +513,9 @@ media-rewind-button media-return-to-realtime-button media-slider media-sliderthumb +media-volume-slider-container +media-volume-slider +media-volume-sliderthumb media-controls-background media-current-time-display media-time-remaining-display @@ -551,6 +558,12 @@ padding padding-box # +# background-size +# +contain +cover + +# # CSS_PROP__KHTML_RTL_ORDERING # logical @@ -611,3 +624,17 @@ fill stroke #all #none + +# +# -webkit-font-smoothing +# +# auto +# none +antialiased +subpixel-antialiased + +# text-rendering +#auto +optimizeSpeed +optimizeLegibility +geometricPrecision diff --git a/WebCore/css/CSSValueList.cpp b/WebCore/css/CSSValueList.cpp index 4928026..9633f7c 100644 --- a/WebCore/css/CSSValueList.cpp +++ b/WebCore/css/CSSValueList.cpp @@ -96,6 +96,14 @@ bool CSSValueList::hasValue(CSSValue* val) return false; } +PassRefPtr<CSSValueList> CSSValueList::copy() +{ + PassRefPtr<CSSValueList> newList = m_isSpaceSeparated ? createSpaceSeparated() : createCommaSeparated(); + for (size_t index = 0; index < m_values.size(); index++) + newList->append(item(index)); + return newList; +} + String CSSValueList::cssText() const { String result = ""; diff --git a/WebCore/css/CSSValueList.h b/WebCore/css/CSSValueList.h index 0d531de..b835345 100644 --- a/WebCore/css/CSSValueList.h +++ b/WebCore/css/CSSValueList.h @@ -54,6 +54,7 @@ public: void prepend(PassRefPtr<CSSValue>); bool removeAll(CSSValue*); bool hasValue(CSSValue*); + PassRefPtr<CSSValueList> copy(); virtual String cssText() const; diff --git a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp index 2cd90a9d..e8492d4 100644 --- a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp +++ b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp @@ -93,8 +93,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro return CSSPrimitiveValue::create(svgStyle->strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyStrokeOpacity: return CSSPrimitiveValue::create(svgStyle->strokeOpacity(), CSSPrimitiveValue::CSS_NUMBER); - case CSSPropertyTextRendering: - return CSSPrimitiveValue::create(svgStyle->textRendering()); case CSSPropertyAlignmentBaseline: return CSSPrimitiveValue::create(svgStyle->alignmentBaseline()); case CSSPropertyDominantBaseline: diff --git a/WebCore/css/SVGCSSParser.cpp b/WebCore/css/SVGCSSParser.cpp index 04ba185..0ae9fbc 100644 --- a/WebCore/css/SVGCSSParser.cpp +++ b/WebCore/css/SVGCSSParser.cpp @@ -132,12 +132,6 @@ bool CSSParser::parseSVGValue(int propId, bool important) valid_primitive = true; break; - case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit - if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility || - id == CSSValueGeometricprecision) - valid_primitive = true; - break; - case CSSPropertyImageRendering: // auto | optimizeSpeed | case CSSPropertyColorRendering: // optimizeQuality | inherit if (id == CSSValueAuto || id == CSSValueOptimizespeed || diff --git a/WebCore/css/SVGCSSPropertyNames.in b/WebCore/css/SVGCSSPropertyNames.in index 965fbbf..e400ffe 100644 --- a/WebCore/css/SVGCSSPropertyNames.in +++ b/WebCore/css/SVGCSSPropertyNames.in @@ -37,7 +37,7 @@ stroke-linejoin stroke-miterlimit stroke-opacity stroke-width -text-rendering +# text-rendering alignment-baseline baseline-shift dominant-baseline diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp index d326dde..b81b4f2 100644 --- a/WebCore/css/SVGCSSStyleSelector.cpp +++ b/WebCore/css/SVGCSSStyleSelector.cpp @@ -229,13 +229,6 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) svgstyle->setShapeRendering(*primitiveValue); break; } - case CSSPropertyTextRendering: - { - HANDLE_INHERIT_AND_INITIAL(textRendering, TextRendering) - if (primitiveValue) - svgstyle->setTextRendering(*primitiveValue); - break; - } // end of ident only properties case CSSPropertyFill: { diff --git a/WebCore/css/SVGCSSValueKeywords.in b/WebCore/css/SVGCSSValueKeywords.in index c866a17..152a68f 100644 --- a/WebCore/css/SVGCSSValueKeywords.in +++ b/WebCore/css/SVGCSSValueKeywords.in @@ -196,7 +196,7 @@ linearRGB # CSS_PROP_COLOR_RENDERING #auto -optimizeSpeed +#optimizeSpeed optimizeQuality ## CSS_PROP_FILL @@ -220,7 +220,7 @@ optimizeQuality #auto #optimizeSpeed crispEdges -geometricPrecision +#geometricPrecision # CSS_PROP_STROKE # CSS_PROP_STROKE_DASHARRAY @@ -238,11 +238,6 @@ bevel # CSS_PROP_STROKE_MITERLIMIT # CSS_PROP_STROKE_OPACITY # CSS_PROP_STROKE_WIDTH -# CSS_PROP_TEXT_RENDERING -#auto -#optimizeSpeed -optimizeLegibility -#geometricPrecision # CSS_PROP_ALIGNMENT_BASELINE #auto diff --git a/WebCore/css/StyleBase.cpp b/WebCore/css/StyleBase.cpp index 4d5c9c8..23a60ee 100644 --- a/WebCore/css/StyleBase.cpp +++ b/WebCore/css/StyleBase.cpp @@ -57,7 +57,7 @@ KURL StyleBase::baseURL() const if (!sheet) return KURL(); if (!sheet->href().isNull()) - return KURL(sheet->href()); + return KURL(ParsedURLString, sheet->href()); if (sheet->parent()) return sheet->parent()->baseURL(); if (!sheet->ownerNode()) @@ -68,16 +68,28 @@ KURL StyleBase::baseURL() const #ifdef ANDROID_INSTRUMENT static size_t styleSize = 0; -void* StyleBase::operator new(size_t s) throw() +void* StyleBase::operator new(size_t size) { - styleSize += s; - return ::operator new(s); + styleSize += size; + return ::operator new(size); } -void StyleBase::operator delete(void* ptr, size_t s) +void* StyleBase::operator new[](size_t size) { - styleSize -= s; - ::operator delete(ptr); + styleSize += size; + return ::operator new[](size); +} + +void StyleBase::operator delete(void* p, size_t size) +{ + styleSize -= size; + ::operator delete(p); +} + +void StyleBase::operator delete[](void* p, size_t size) +{ + styleSize -= size; + ::operator delete[](p); } size_t StyleBase::reportStyleSize() diff --git a/WebCore/css/StyleBase.h b/WebCore/css/StyleBase.h index a1660ab..5f9124d 100644 --- a/WebCore/css/StyleBase.h +++ b/WebCore/css/StyleBase.h @@ -74,10 +74,12 @@ namespace WebCore { #ifdef ANDROID_INSTRUMENT // Overridden to prevent the normal new from being called. - void* operator new(size_t) throw(); + void* operator new(size_t size); + void* operator new[](size_t size); // Overridden to prevent the normal delete from being called. - void operator delete(void*, size_t); + void operator delete(void* p, size_t size); + void operator delete[](void* p, size_t size); static size_t reportStyleSize(); #endif diff --git a/WebCore/css/StyleSheetList.idl b/WebCore/css/StyleSheetList.idl index 2abd22f..574d749 100644 --- a/WebCore/css/StyleSheetList.idl +++ b/WebCore/css/StyleSheetList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module stylesheets { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, HasNameGetter, diff --git a/WebCore/css/WCSSPropertyNames.in b/WebCore/css/WCSSPropertyNames.in new file mode 100644 index 0000000..704209f --- /dev/null +++ b/WebCore/css/WCSSPropertyNames.in @@ -0,0 +1,4 @@ +-wap-marquee-dir +-wap-marquee-loop +-wap-marquee-speed +-wap-marquee-style diff --git a/WebCore/css/WCSSValueKeywords.in b/WebCore/css/WCSSValueKeywords.in new file mode 100644 index 0000000..00657ba --- /dev/null +++ b/WebCore/css/WCSSValueKeywords.in @@ -0,0 +1 @@ +# place holder for all WCSS specific CSS value keywords diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 6b03390..095fab3 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -72,6 +72,10 @@ layer { display: block } +nav { + display: block +} + marquee { display: inline-block; overflow: -webkit-marquee @@ -350,6 +354,11 @@ input[type="search"]::-webkit-search-results-button { display: inline-block; } +input::-webkit-input-list-button { + -webkit-appearance: list-button; + display: inline-block; +} + textarea { -webkit-appearance: textarea; background-color: white; @@ -364,7 +373,7 @@ textarea { word-wrap: break-word; } -input::-webkit-input-placeholder, isindex::-webkit-input-placeholder { +input::-webkit-input-placeholder, isindex::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: darkGray; } @@ -483,6 +492,10 @@ select[size="1"] { white-space: pre; } +datalist { + display: none; +} + optgroup { font-weight: bolder; } diff --git a/WebCore/css/mathml.css b/WebCore/css/mathml.css new file mode 100644 index 0000000..e725d8c --- /dev/null +++ b/WebCore/css/mathml.css @@ -0,0 +1,170 @@ +@namespace "http://www.w3.org/1998/Math/MathML"; + +/* approved */ +math { + font-family: Symbol, STIXGeneral, "Times New Roman"; + display: inline-block; + padding: 0px; + margin: 0px; + text-indent: 0; + font-size: 1.1em; + vertical-align: baseline; +} +math[display="block"] { + font-family: "New Times Roman" + display: block; + text-align: center; + page-break-inside: avoid; +} + +mfrac { + vertical-align: middle; +} + +msub, msup { + display: inline-block; +} + +msub > * + * { + vertical-align: sub; + font-size: 0.75em; + line-height: 0.75em; +} + +msup > * + * { + vertical-align: super; + font-size: 0.75em; + line-height: 0.75em; +} + +msubsup > * { + margin: 0px; + padding: 0px; + vertical-align: middle; +} + +msubsup > * + * { + font-size: 0.75em; + line-height: 0.75em; +} + +munderover { + vertical-align: middle; +} + +munderover > * + *, mover > * + *, munder > * + * { + font-size: 0.75em; + line-height: 0.5625em; +} + +mrow { + line-height: 1em; + white-space: nowrap; + vertical-align: middle; +} + +mfenced > * { + vertical-align: middle; +} + +mo, mn, mi { + line-height: 0.75em; + padding: 0px; + margin: 0px; +} + +mo[mathsize="small"], mn[mathsize="small"], mi[mathsize="small"] { + font-size: 0.75em; + line-height: 0.5625em; +} + +mo[mathsize="normal"],mn[mathsize="normal"],mi[mathsize="normal"] { + font-size: 1em; + line-height: 0.75em; +} + +mo[mathsize="big"], mn[mathsize="big"], mi[mathsize="big"] { + line-height: 1.2em; + font-size: 1.5em; +} + +annotation, annotation-xml { + display:none; +} + +mphantom { + visibility: hidden; +} +merror { + outline: solid thin red; +} + +msqrt { + padding-top: 0.2em; + padding-left: 0.75em; +} + +mroot { + padding-top: 0.2em; + padding-left: 0.2em; +} + +mroot > * + * { + font-size: 0.75em; + line-height: 0.75em; + vertical-align: top; + padding-right: 0.3em; +} + +mtable { + display: inline-table; + line-height: 1.5em; + text-align: center; + vertical-align: middle; +} +mtr { + display: table-row; +} +mtd { + display: table-cell; + padding: 0 0.5ex; +} + +mtable[columnalign="left"], mtr[columnalign="left"], mtd[columnalign="left"] { + text-align: left; +} + +mtable[columnalign="right"], mtr[columnalign="right"], mtd[columnalign="right"] { + text-align: right; +} +mtable[rowalign="top"] mtd, mtable mtr[rowalign="top"] mtd, mtable mtr mtd[rowalign="top"] { + vertical-align: top; +} +mtable[rowalign="bottom"] mtd, mtable mtr[rowalign="bottom"] mtd, mtable mtr mtd[rowalign="bottom"] { + vertical-align: bottom; +} +mtable[rowalign="center"] mtd, mtable mtr[rowalign="center"] mtd, mtable mtr mtd[rowalign="center"] { + vertical-align: middle; +} +mtable[frame="solid"] { + border: solid thin; +} +mtable[frame="dashed"] { + border: dashed thin; +} +mtable[rowlines="solid"], mtable[rowlines="dashed"], mtable[columnlines="solid"], mtable[columnlines="dashed"] { + border-collapse: collapse; +} +mtable[rowlines="solid"] > mtr + mtr { + border-top: solid thin; +} +mtable[rowlines="dashed"] > mtr + mtr { + border-top: dashed thin; +} +mtable[columnlines="solid"] > mtr > mtd + mtd { + border-left: solid thin; +} +mtable[columnlines="dashed"] > mtr > mtd + mtd { + border-left: dashed thin; +} + diff --git a/WebCore/css/mediaControls.css b/WebCore/css/mediaControls.css index f9694f8..d0ec90d 100644 --- a/WebCore/css/mediaControls.css +++ b/WebCore/css/mediaControls.css @@ -88,6 +88,14 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { padding: 0px 2px; } +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; +} + audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { -webkit-appearance: media-seek-back-button; display: -webkit-box; diff --git a/WebCore/css/mediaControlsChromium.css b/WebCore/css/mediaControlsChromium.css index 6fda61c..0f667bd 100644 --- a/WebCore/css/mediaControlsChromium.css +++ b/WebCore/css/mediaControlsChromium.css @@ -33,6 +33,7 @@ audio { audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { -webkit-user-select: none; position: absolute; + overflow: visible; bottom: 0; width: 100%; height: 32px; @@ -46,7 +47,6 @@ video:-webkit-full-page-media::-webkit-media-controls-panel { audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { -webkit-appearance: media-mute-button; - position: absolute; top: auto; bottom: 0; @@ -83,8 +83,8 @@ audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls- width: auto; height: 32px; - border-left-color: rgba(255, 255, 255, 0.2); - border-right-color: rgba(255, 255, 255, 0.2); + border-left: 1px solid rgba(255, 255, 255, 0.2); + border-right: 1px solid rgba(255, 255, 255, 0.2); } audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display { @@ -141,12 +141,13 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { -webkit-appearance: media-slider; position: absolute; top: auto; - bottom: 8px; + bottom: 7px; left: 6px; right: 65px; height: 16px; border-color: rgba(255, 255, 255, 0.2); + border-style: solid; border-width: 1px; border-radius: 2px; background-color: rgba(255, 255, 255, 0.08); @@ -167,3 +168,25 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f -webkit-appearance: media-fullscreen-button; display: none; } + +audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { + -webkit-appearance: media-volume-slider-container; + position: absolute; + + width: 34px; + height: 100px; + + background-color: rgba(0, 0, 0, 0.6); +} + +audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider { + -webkit-appearance: media-volume-slider; + display: inline; + position: absolute; + + top: 10px; + left: 12px; + + width: 10px; + height: 80px; +} diff --git a/WebCore/css/qt/mediaControls-extras.css b/WebCore/css/mediaControlsQt.css index d85deae..a9c3609 100644 --- a/WebCore/css/qt/mediaControls-extras.css +++ b/WebCore/css/mediaControlsQt.css @@ -25,18 +25,38 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* QtWebKit media controls. Extends mediaControls.css */ + audio { height: 34px; width: 400px; } +audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: end; + -webkit-user-select: none; + position: absolute; + bottom: 0; + width: 100%; + z-index: 0; + overflow: hidden; + height: 100%; + text-align: right; +} + +video:-webkit-full-page-media::-webkit-media-controls-panel { + display: none; +} + audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { left: auto; right: 5px; width: 12px; height: 12px; padding: 6px; - margin: 5px 0px; + margin: 5px 5px 5px 3px; } audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { @@ -44,17 +64,18 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu width: 9px; height: 12px; padding: 6px 12px 6px 11px; - margin: 5px 0px; + margin: 5px 3px 5px 5px; } -audio::-webkit-media-controls-time-display, video::-webkit-media-controls-time-display { - /* Since MediaControlElements are always created with a renderer we have to hide - the controls we don't use, so they don't mess up activation and event handling */ - left: 0px; - top: 0px; - width: 0px; - height: 0px; +audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container { + height: 34px; +} +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; } @@ -66,6 +87,14 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { margin: 5px 0px; } +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; +} + audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { /* Since MediaControlElements are always created with a renderer we have to hide the controls we don't use, so they don't mess up activation and event handling */ @@ -99,3 +128,11 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f display: none; } +audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { + display: none; +} + +audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { + display: none; +} + diff --git a/WebCore/css/mediaControlsQT.css b/WebCore/css/mediaControlsQuickTime.css index 5cf48ae..5cf48ae 100644 --- a/WebCore/css/mediaControlsQT.css +++ b/WebCore/css/mediaControlsQuickTime.css |