Merge from Chromium at DEPS revision r202854
This commit was generated by merge_to_master.py.
Change-Id: I5b225b76b2157384357897051ee5866dd4bb23a8
diff --git a/Source/core/css/CSS.idl b/Source/core/css/CSS.idl
index 133d905..4ba9ba7 100644
--- a/Source/core/css/CSS.idl
+++ b/Source/core/css/CSS.idl
@@ -29,8 +29,7 @@
[
NoInterfaceObject,
- ImplementedAs=DOMWindowCSS,
- ImplementationLacksVTable
+ ImplementedAs=DOMWindowCSS
] interface CSS {
boolean supports(DOMString property, DOMString value);
boolean supports(DOMString conditionText);
diff --git a/Source/core/css/CSSBasicShapes.cpp b/Source/core/css/CSSBasicShapes.cpp
index ac65e2e..3cb6b74 100644
--- a/Source/core/css/CSSBasicShapes.cpp
+++ b/Source/core/css/CSSBasicShapes.cpp
@@ -30,7 +30,6 @@
#include "config.h"
#include "core/css/CSSBasicShapes.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSBorderImageSliceValue.cpp b/Source/core/css/CSSBorderImageSliceValue.cpp
index 86c536e..0c4eed0 100644
--- a/Source/core/css/CSSBorderImageSliceValue.cpp
+++ b/Source/core/css/CSSBorderImageSliceValue.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "core/css/CSSBorderImageSliceValue.h"
-#include "core/css/Rect.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/text/WTFString.h>
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp
index b1ec9ea..d273563 100644
--- a/Source/core/css/CSSCalculationValue.cpp
+++ b/Source/core/css/CSSCalculationValue.cpp
@@ -31,10 +31,8 @@
#include "config.h"
#include "core/css/CSSCalculationValue.h"
-#include "core/css/CSSValueList.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/platform/Length.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
diff --git a/Source/core/css/CSSCanvasValue.cpp b/Source/core/css/CSSCanvasValue.cpp
index e548ce2..cf9cc51 100644
--- a/Source/core/css/CSSCanvasValue.cpp
+++ b/Source/core/css/CSSCanvasValue.cpp
@@ -27,7 +27,6 @@
#include "core/css/CSSCanvasValue.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/platform/graphics/ImageBuffer.h"
#include "core/rendering/RenderObject.h"
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index c13bfc1..36a24bb 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -28,7 +28,6 @@
#include "WebKitFontFamilyNames.h"
#include "core/css/BasicShapeFunctions.h"
#include "core/css/CSSAspectRatioValue.h"
-#include "core/css/CSSBasicShapes.h"
#include "core/css/CSSBorderImage.h"
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSLineBoxContainValue.h"
@@ -53,19 +52,16 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/PseudoElement.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/html/HTMLFrameOwnerElement.h"
#include "core/page/RuntimeCSSEnabled.h"
#include "core/page/animation/AnimationController.h"
#include "core/platform/graphics/FontFeatureSettings.h"
#include "core/rendering/RenderBox.h"
#include "core/rendering/RenderView.h"
-#include "core/rendering/style/BasicShapes.h"
#include "core/rendering/style/ContentData.h"
#include "core/rendering/style/CounterContent.h"
#include "core/rendering/style/CursorList.h"
#include "core/rendering/style/ExclusionShapeValue.h"
#include "core/rendering/style/RenderStyle.h"
-#include "core/rendering/style/StyleInheritedData.h"
#include <wtf/text/StringBuilder.h>
#include "core/css/WebKitCSSArrayFunctionValue.h"
@@ -188,6 +184,7 @@
CSSPropertyTextOverflow,
CSSPropertyTextTransform,
CSSPropertyTop,
+ CSSPropertyTouchAction,
CSSPropertyTransitionDelay,
CSSPropertyTransitionDuration,
CSSPropertyTransitionProperty,
@@ -344,7 +341,6 @@
CSSPropertyWebkitShapeMargin,
CSSPropertyWebkitShapePadding,
CSSPropertyWebkitWrapThrough,
-#if ENABLE(SVG)
CSSPropertyBufferedRendering,
CSSPropertyClipPath,
CSSPropertyClipRule,
@@ -384,7 +380,6 @@
CSSPropertyGlyphOrientationVertical,
CSSPropertyWebkitSvgShadow,
CSSPropertyVectorEffect
-#endif
};
static const Vector<CSSPropertyID>& computableProperties()
@@ -549,7 +544,7 @@
// Create the repeat rules.
RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
- return createBorderImageValue(imageValue, imageSlices, borderSlices, outset, repeat);
+ return createBorderImageValue(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat.release());
}
inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle* style)
@@ -713,7 +708,7 @@
if (showHorizontalBottomLeft)
horizontalRadii->append(bottomLeftRadius->item(0));
- list->append(horizontalRadii);
+ list->append(horizontalRadii.release());
if (showVerticalTopLeft) {
RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
@@ -724,7 +719,7 @@
verticalRadii->append(bottomRightRadius->item(1));
if (showVerticalBottomLeft)
verticalRadii->append(bottomLeftRadius->item(1));
- list->append(verticalRadii);
+ list->append(verticalRadii.release());
}
return list.release();
}
@@ -814,7 +809,10 @@
static PassRefPtr<CSSValue> valueForCustomFilterTransformParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterTransformParameter* transformParameter)
{
- IntSize size = renderer ? pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size() : IntSize();
+ IntSize size;
+ if (renderer && renderer->isBox())
+ size = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size();
+
TransformationMatrix transform;
transformParameter->applyTransform(transform, size);
// FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
@@ -985,7 +983,7 @@
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::UnknownFilterOperation);
break;
}
- list->append(filterValue);
+ list->append(filterValue.release());
}
return list.release();
@@ -1063,12 +1061,15 @@
if (position.isAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);
- if (position.isInteger())
- return cssValuePool().createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER);
-
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
- list->append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
+ if (position.isSpan()) {
+ list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
+ list->append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
+ } else
+ list->append(cssValuePool().createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
+
+ if (!position.namedGridLine().isNull())
+ list->append(cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
return list;
}
static PassRefPtr<CSSValue> createTransitionPropertyValue(const CSSAnimationData* animation)
@@ -1310,11 +1311,11 @@
{
// Blink value is ignored.
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (textDecoration & UNDERLINE)
+ if (textDecoration & TextDecorationUnderline)
list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
- if (textDecoration & OVERLINE)
+ if (textDecoration & TextDecorationOverline)
list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
- if (textDecoration & LINE_THROUGH)
+ if (textDecoration & TextDecorationLineThrough)
list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
if (!list->length())
@@ -1835,7 +1836,7 @@
}
RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
if (list) {
- list->append(value);
+ list->append(value.release());
return list.release();
}
return value.release();
@@ -2202,6 +2203,8 @@
return cssValuePool().createValue(style->textTransform());
case CSSPropertyTop:
return getPositionOffsetValue(style.get(), CSSPropertyTop, renderer, m_node->document()->renderView());
+ case CSSPropertyTouchAction:
+ return cssValuePool().createValue(style->touchAction());
case CSSPropertyUnicodeBidi:
return cssValuePool().createValue(style->unicodeBidi());
case CSSPropertyVerticalAlign:
@@ -2561,12 +2564,10 @@
if (ClipPathOperation* operation = style->clipPath()) {
if (operation->getOperationType() == ClipPathOperation::SHAPE)
return valueForBasicShape(static_cast<ShapeClipPathOperation*>(operation)->basicShape());
-#if ENABLE(SVG)
- else if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
+ if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation);
return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI);
}
-#endif
}
return cssValuePool().createIdentifierValue(CSSValueNone);
case CSSPropertyWebkitFlowInto:
@@ -2664,17 +2665,14 @@
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
case CSSPropertyWebkitTextEmphasis:
- case CSSPropertyTextLineThrough:
case CSSPropertyTextLineThroughColor:
case CSSPropertyTextLineThroughMode:
case CSSPropertyTextLineThroughStyle:
case CSSPropertyTextLineThroughWidth:
- case CSSPropertyTextOverline:
case CSSPropertyTextOverlineColor:
case CSSPropertyTextOverlineMode:
case CSSPropertyTextOverlineStyle:
case CSSPropertyTextOverlineWidth:
- case CSSPropertyTextUnderline:
case CSSPropertyTextUnderlineColor:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
@@ -2742,7 +2740,6 @@
case CSSPropertyWebkitTransformOriginX:
case CSSPropertyWebkitTransformOriginY:
case CSSPropertyWebkitTransformOriginZ:
- case CSSPropertyWebkitWrap:
break;
#if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -2753,7 +2750,6 @@
break;
#endif
-#if ENABLE(SVG)
case CSSPropertyBufferedRendering:
case CSSPropertyClipPath:
case CSSPropertyClipRule:
@@ -2797,7 +2793,6 @@
case CSSPropertyWritingMode:
case CSSPropertyWebkitSvgShadow:
return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout);
-#endif
}
logUnimplementedPropertyID(propertyID);
@@ -2850,7 +2845,7 @@
return value && propertyValue && value->equals(*propertyValue);
}
-PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copy() const
+PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyProperties() const
{
return copyPropertiesInSet(computableProperties());
}
@@ -2882,13 +2877,13 @@
bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
- list->append(topValue);
+ list->append(topValue.release());
if (showRight)
- list->append(rightValue);
+ list->append(rightValue.release());
if (showBottom)
- list->append(bottomValue);
+ list->append(bottomValue.release());
if (showLeft)
- list->append(leftValue);
+ list->append(leftValue.release());
return list.release();
}
@@ -2898,12 +2893,12 @@
RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i], DoNotUpdateLayout);
- list->append(value);
+ list->append(value.release());
}
return list.release();
}
-PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
+PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
{
Vector<CSSProperty, 256> list;
list.reserveInitialCapacity(properties.size());
@@ -2912,7 +2907,7 @@
if (value)
list.append(CSSProperty(properties[i], value.release(), false));
}
- return StylePropertySet::create(list.data(), list.size());
+ return MutableStylePropertySet::create(list.data(), list.size());
}
void CSSComputedStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
diff --git a/Source/core/css/CSSComputedStyleDeclaration.h b/Source/core/css/CSSComputedStyleDeclaration.h
index e922fb2..05c7cb3 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.h
+++ b/Source/core/css/CSSComputedStyleDeclaration.h
@@ -31,6 +31,7 @@
class CSSPrimitiveValue;
class CSSValueList;
class Color;
+class MutableStylePropertySet;
class Node;
class RenderObject;
class RenderStyle;
@@ -59,16 +60,14 @@
String getPropertyValue(CSSPropertyID) const;
bool getPropertyPriority(CSSPropertyID) const;
- virtual PassRefPtr<StylePropertySet> copy() const;
+ virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE;
PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
bool useFixedFontDefaultSize() const;
-#if ENABLE(SVG)
PassRefPtr<CSSValue> getSVGPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
-#endif
- PassRefPtr<StylePropertySet> copyPropertiesInSet(const Vector<CSSPropertyID>&) const;
+ PassRefPtr<MutableStylePropertySet> copyPropertiesInSet(const Vector<CSSPropertyID>&) const;
virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
@@ -103,9 +102,7 @@
PassRefPtr<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, const RenderStyle*) const;
PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
-#if ENABLE(SVG)
PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
-#endif
PassRefPtr<CSSValue> valueForFilter(const RenderObject*, const RenderStyle*) const;
diff --git a/Source/core/css/CSSCrossfadeValue.cpp b/Source/core/css/CSSCrossfadeValue.cpp
index c6dd028..d0321c0 100644
--- a/Source/core/css/CSSCrossfadeValue.cpp
+++ b/Source/core/css/CSSCrossfadeValue.cpp
@@ -29,12 +29,9 @@
#include "core/css/CSSImageValue.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/loader/cache/CachedImage.h"
-#include "core/loader/cache/CachedResourceLoader.h"
#include "core/platform/graphics/CrossfadeGeneratedImage.h"
-#include "core/platform/graphics/ImageBuffer.h"
#include "core/rendering/RenderObject.h"
#include "core/rendering/style/StyleCachedImage.h"
-#include "core/rendering/style/StyleGeneratedImage.h"
#include <wtf/text/StringBuilder.h>
namespace WebCore {
diff --git a/Source/core/css/CSSCursorImageValue.cpp b/Source/core/css/CSSCursorImageValue.cpp
index 3e7e718..62bff86 100644
--- a/Source/core/css/CSSCursorImageValue.cpp
+++ b/Source/core/css/CSSCursorImageValue.cpp
@@ -22,9 +22,9 @@
#include "config.h"
#include "core/css/CSSCursorImageValue.h"
+#include "SVGNames.h"
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSImageValue.h"
-#include "core/dom/TreeScope.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/loader/cache/CachedImage.h"
#include "core/loader/cache/CachedResourceLoader.h"
@@ -32,21 +32,16 @@
#include "core/rendering/style/StyleCachedImageSet.h"
#include "core/rendering/style/StyleImage.h"
#include "core/rendering/style/StylePendingImage.h"
+#include "core/svg/SVGCursorElement.h"
+#include "core/svg/SVGLengthContext.h"
+#include "core/svg/SVGURIReference.h"
#include <wtf/MathExtras.h>
#include <wtf/MemoryInstrumentationHashSet.h>
#include <wtf/UnusedParam.h>
#include <wtf/text/WTFString.h>
-#if ENABLE(SVG)
-#include "SVGNames.h"
-#include "core/svg/SVGCursorElement.h"
-#include "core/svg/SVGLengthContext.h"
-#include "core/svg/SVGURIReference.h"
-#endif
-
namespace WebCore {
-#if ENABLE(SVG)
static inline SVGCursorElement* resourceReferencedByCursorElement(const String& url, Document* document)
{
Element* element = SVGURIReference::targetElementFromIRIString(url, document);
@@ -55,7 +50,6 @@
return 0;
}
-#endif
CSSCursorImageValue::CSSCursorImageValue(PassRefPtr<CSSValue> imageValue, bool hasHotSpot, const IntPoint& hotSpot)
: CSSValue(CursorImageClass)
@@ -68,7 +62,6 @@
CSSCursorImageValue::~CSSCursorImageValue()
{
-#if ENABLE(SVG)
if (!isSVGCursor())
return;
@@ -82,7 +75,6 @@
if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement->document()))
cursorElement->removeClient(referencedElement);
}
-#endif
}
String CSSCursorImageValue::customCssText() const
@@ -100,9 +92,6 @@
bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
{
-#if !ENABLE(SVG)
- UNUSED_PARAM(element);
-#else
if (!element || !element->isSVGElement())
return false;
@@ -129,7 +118,6 @@
cursorElement->addClient(svgElement);
return true;
}
-#endif
return false;
}
@@ -142,7 +130,6 @@
if (!m_accessedImage) {
m_accessedImage = true;
-#if ENABLE(SVG)
// For SVG images we need to lazily substitute in the correct URL. Rather than attempt
// to change the URL of the CSSImageValue (which would then change behavior like cssText),
// we create an alternate CSSImageValue to use.
@@ -156,7 +143,6 @@
return cachedImage;
}
}
-#endif
if (m_imageValue->isImageValue())
m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader);
@@ -180,7 +166,6 @@
return m_image.get();
}
-#if ENABLE(SVG)
bool CSSCursorImageValue::isSVGCursor() const
{
if (m_imageValue->isImageValue()) {
@@ -195,7 +180,7 @@
{
if (!m_image || !m_image->isCachedImage())
return String();
- return static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->url();
+ return static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->url().string();
}
void CSSCursorImageValue::clearCachedImage()
@@ -208,7 +193,6 @@
{
m_referencedElements.remove(element);
}
-#endif
bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const
{
@@ -221,9 +205,7 @@
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
m_imageValue->reportMemoryUsage(memoryObjectInfo);
// No need to report m_image as it is counted as part of RenderArena.
-#if ENABLE(SVG)
info.addMember(m_referencedElements, "referencedElements");
-#endif
}
} // namespace WebCore
diff --git a/Source/core/css/CSSCursorImageValue.h b/Source/core/css/CSSCursorImageValue.h
index 6652408..e3a85e2 100644
--- a/Source/core/css/CSSCursorImageValue.h
+++ b/Source/core/css/CSSCursorImageValue.h
@@ -55,9 +55,7 @@
StyleImage* cachedImage(CachedResourceLoader*);
StyleImage* cachedOrPendingImage(Document*);
-#if ENABLE(SVG)
void removeReferencedElement(SVGElement*);
-#endif
bool equals(const CSSCursorImageValue&) const;
@@ -66,11 +64,9 @@
private:
CSSCursorImageValue(PassRefPtr<CSSValue> imageValue, bool hasHotSpot, const IntPoint& hotSpot);
-#if ENABLE(SVG)
bool isSVGCursor() const;
String cachedImageURL();
void clearCachedImage();
-#endif
RefPtr<CSSValue> m_imageValue;
@@ -79,9 +75,7 @@
RefPtr<StyleImage> m_image;
bool m_accessedImage;
-#if ENABLE(SVG)
HashSet<SVGElement*> m_referencedElements;
-#endif
};
} // namespace WebCore
diff --git a/Source/core/css/CSSDefaultStyleSheets.cpp b/Source/core/css/CSSDefaultStyleSheets.cpp
index 62ccf16..c9aa381 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -33,9 +33,6 @@
#include "core/css/MediaQueryEvaluator.h"
#include "core/css/RuleSet.h"
#include "core/css/StyleSheetContents.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/Page.h"
#include "core/rendering/RenderTheme.h"
namespace WebCore {
@@ -159,7 +156,6 @@
changedDefaultStyle = true;
}
-#if ENABLE(SVG)
if (element->isSVGElement() && !svgStyleSheet) {
// SVG rules.
svgStyleSheet = parseUASheet(svgUserAgentStyleSheet, sizeof(svgUserAgentStyleSheet));
@@ -167,7 +163,6 @@
defaultPrintStyle->addRulesFromSheet(svgStyleSheet, printEval());
changedDefaultStyle = true;
}
-#endif
if (!mediaControlsStyleSheet && (element->hasTagName(videoTag) || element->hasTagName(audioTag))) {
String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme::themeForPage(element->document()->page())->extraMediaControlsStyleSheet();
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp
index 8d955f3..4400c92 100644
--- a/Source/core/css/CSSFontFace.cpp
+++ b/Source/core/css/CSSFontFace.cpp
@@ -32,7 +32,6 @@
#include "core/css/FontLoader.h"
#include "core/dom/Document.h"
#include "RuntimeEnabledFeatures.h"
-#include "core/platform/graphics/FontDescription.h"
#include "core/platform/graphics/SimpleFontData.h"
namespace WebCore {
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 40a5a7d..53c9347 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -28,9 +28,7 @@
#include "core/css/CSSFontFace.h"
#include "core/css/CSSFontSelector.h"
-#include "core/dom/Document.h"
#include "core/loader/cache/CachedFont.h"
-#include "core/loader/cache/CachedResourceLoader.h"
#include "core/platform/HistogramSupport.h"
#include "core/platform/graphics/FontCache.h"
#include "core/platform/graphics/FontDescription.h"
@@ -42,7 +40,6 @@
#include "core/svg/SVGFontData.h"
#include "core/svg/SVGFontElement.h"
#include "core/svg/SVGFontFaceElement.h"
-#include "core/svg/SVGURIReference.h"
#endif
namespace WebCore {
diff --git a/Source/core/css/CSSFontFaceSrcValue.cpp b/Source/core/css/CSSFontFaceSrcValue.cpp
index 4eec5d5..302a327 100644
--- a/Source/core/css/CSSFontFaceSrcValue.cpp
+++ b/Source/core/css/CSSFontFaceSrcValue.cpp
@@ -97,8 +97,7 @@
CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
{
if (!m_cachedFont) {
- CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)));
- request.setInitiator(cachedResourceRequestInitiators().css);
+ CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)), cachedResourceRequestInitiators().css);
m_cachedFont = document->cachedResourceLoader()->requestFont(request);
}
return m_cachedFont.get();
diff --git a/Source/core/css/CSSFontSelector.cpp b/Source/core/css/CSSFontSelector.cpp
index 8b9712c..eb12e24 100644
--- a/Source/core/css/CSSFontSelector.cpp
+++ b/Source/core/css/CSSFontSelector.cpp
@@ -49,13 +49,8 @@
#include "core/page/Settings.h"
#include "core/platform/graphics/FontCache.h"
#include "core/platform/graphics/SimpleFontData.h"
-#include "core/rendering/RenderObject.h"
-#include <wtf/text/AtomicString.h>
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGFontFaceElement.h"
-#endif
+#include "wtf/text/AtomicString.h"
using namespace std;
diff --git a/Source/core/css/CSSGradientValue.cpp b/Source/core/css/CSSGradientValue.cpp
index ee15dc2..90294b9 100644
--- a/Source/core/css/CSSGradientValue.cpp
+++ b/Source/core/css/CSSGradientValue.cpp
@@ -35,7 +35,6 @@
#include "core/platform/graphics/Gradient.h"
#include "core/platform/graphics/Image.h"
#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/IntSizeHash.h"
#include "core/rendering/RenderObject.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index 7eac66e..574a3a8 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -87,7 +87,7 @@
%}
-%expect 32
+%expect 29
%nonassoc LOWEST_PREC
@@ -223,11 +223,12 @@
%type <rule> host
%type <rule> keyframes
%type <rule> invalid_rule
-%type <rule> save_block
%type <rule> invalid_at
%type <rule> rule
%type <rule> valid_rule
+%type <ruleList> block_rule_body
%type <ruleList> block_rule_list
+%type <ruleList> region_block_rule_body
%type <ruleList> region_block_rule_list
%type <rule> block_rule
%type <rule> block_valid_rule
@@ -263,11 +264,11 @@
%type <boolean> supports_conjunction
%type <boolean> supports_disjunction
%type <boolean> supports_declaration_condition
-%type <boolean> supports_error
%type <string> keyframe_name
%type <keyframe> keyframe_rule
%type <keyframeRuleList> keyframes_rule
+%type <keyframeRuleList> keyframe_rule_list
%type <valueList> key_list
%type <value> key
@@ -277,6 +278,7 @@
%type <selector> specifier_list
%type <selector> simple_selector
%type <selector> selector
+%type <selector> relative_selector
%type <selectorList> selector_list
%type <selectorList> simple_selector_list
%type <selectorList> region_selector
@@ -417,18 +419,16 @@
parser->startEndUnknownRule();
$$ = 0;
}
- | CHARSET_SYM error invalid_block {
- }
- | CHARSET_SYM error ';' {
+ | CHARSET_SYM at_rule_recovery {
}
;
ignored_charset:
- CHARSET_SYM maybe_space STRING maybe_space ';' {
+ CHARSET_SYM rule_error_recovery ';' {
// Ignore any @charset rule not at the beginning of the style sheet.
$$ = 0;
}
- | CHARSET_SYM maybe_space ';' {
+ | CHARSET_SYM rule_error_recovery invalid_block {
$$ = 0;
}
;
@@ -467,6 +467,10 @@
| invalid_at
;
+block_rule_body:
+ block_rule_list
+ | block_rule_list error rule_error_recovery;
+
block_rule_list:
/* empty */ { $$ = 0; }
| block_rule_list block_rule maybe_sgml {
@@ -479,6 +483,10 @@
}
;
+region_block_rule_body:
+ region_block_rule_list
+ | region_block_rule_list error rule_error_recovery;
+
region_block_rule_list:
/* empty */ { $$ = 0; }
| region_block_rule_list block_valid_rule maybe_sgml {
@@ -506,6 +514,7 @@
block_rule:
block_valid_rule
+ | ignored_charset
| invalid_rule
| invalid_at
| namespace
@@ -537,11 +546,7 @@
$$ = 0;
parser->endRuleBody(true);
}
- | before_import_rule IMPORT_SYM error ';' {
- $$ = 0;
- parser->endRuleBody(true);
- }
- | before_import_rule IMPORT_SYM error invalid_block {
+ | before_import_rule IMPORT_SYM at_rule_recovery {
$$ = 0;
parser->endRuleBody(true);
}
@@ -555,10 +560,7 @@
| NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_block {
$$ = 0;
}
-| NAMESPACE_SYM error invalid_block {
- $$ = 0;
-}
-| NAMESPACE_SYM error ';' {
+| NAMESPACE_SYM at_rule_recovery {
$$ = 0;
}
;
@@ -595,7 +597,7 @@
if ($1 != MediaQuery::None)
$$ = parser->createFloatingMediaQueryExp("", 0);
else {
- $5.lower();
+ parser->tokenToLowerCase($5);
$$ = parser->createFloatingMediaQueryExp($5, $7);
}
}
@@ -639,7 +641,7 @@
}
|
maybe_media_restrictor maybe_space medium maybe_and_media_query_exp_list {
- $3.lower();
+ parser->tokenToLowerCase($3);
$$ = parser->createFloatingMediaQuery($1, $3, parser->sinkFloatingMediaQueryExpList($4));
}
;
@@ -688,13 +690,13 @@
;
media:
- before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at_rule_body_start maybe_space block_rule_list save_block {
+ before_media_rule MEDIA_SYM maybe_space media_list at_rule_header_end '{' at_rule_body_start maybe_space block_rule_body closing_brace {
$$ = parser->createMediaRule($4, $9);
}
- | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space block_rule_list save_block {
+ | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space block_rule_body closing_brace {
$$ = parser->createMediaRule(0, $7);
}
- | before_media_rule MEDIA_SYM at_rule_header_end_maybe_space ';' {
+ | before_media_rule MEDIA_SYM at_rule_recovery {
$$ = 0;
parser->endRuleBody(true);
}
@@ -707,23 +709,17 @@
;
supports:
- before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports_rule_header_end '{' at_rule_body_start maybe_space block_rule_list save_block {
+ before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports_rule_header_end '{' at_rule_body_start maybe_space block_rule_body closing_brace {
$$ = parser->createSupportsRule($4, $9);
}
- | before_supports_rule SUPPORTS_SYM supports_error {
+ | before_supports_rule SUPPORTS_SYM error error_location rule_error_recovery at_rule_end {
$$ = 0;
+ parser->reportError($4, CSSParser::InvalidSupportsConditionError);
parser->endRuleBody(true);
parser->popSupportsRuleData();
}
;
-supports_error:
- error ';' {
- }
- | error invalid_block {
- }
- ;
-
before_supports_rule:
/* empty */ {
parser->startRuleHeader(CSSRuleSourceData::SUPPORTS_RULE);
@@ -774,25 +770,32 @@
$$ = $3;
}
| supports_declaration_condition
- | '(' error ')' {
+ | '(' error error_location error_recovery ')' {
+ parser->reportError($3, CSSParser::InvalidSupportsConditionError);
$$ = false;
}
;
supports_declaration_condition:
- '(' maybe_space property ':' maybe_space expr prio ')' maybe_space {
+ '(' maybe_space IDENT maybe_space ':' maybe_space expr prio ')' maybe_space {
$$ = false;
- CSSParser* p = static_cast<CSSParser*>(parser);
- if ($3 && $6) {
- p->m_valueList = p->sinkFloatingValueList($6);
- int oldParsedProperties = p->m_parsedProperties.size();
- $$ = p->parseValue(static_cast<CSSPropertyID>($3), $7);
- // We just need to know if the declaration is supported as it is written. Rollback any additions.
- if ($$)
- p->rollbackLastProperties(p->m_parsedProperties.size() - oldParsedProperties);
- p->m_valueList = nullptr;
+ if ($7) {
+ CSSPropertyID id = cssPropertyID($3);
+ if (id != CSSPropertyInvalid) {
+ parser->m_valueList = parser->sinkFloatingValueList($7);
+ int oldParsedProperties = parser->m_parsedProperties.size();
+ $$ = parser->parseValue(id, $8);
+ // We just need to know if the declaration is supported as it is written. Rollback any additions.
+ if ($$)
+ parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
+ }
+ parser->m_valueList = nullptr;
}
- p->endProperty($7, false);
+ parser->endProperty($8, false);
+ }
+ | '(' maybe_space IDENT maybe_space ':' maybe_space error error_recovery ')' maybe_space {
+ $$ = false;
+ parser->endProperty(false, false, CSSParser::GeneralError);
}
;
@@ -806,6 +809,10 @@
before_keyframes_rule WEBKIT_KEYFRAMES_SYM maybe_space keyframe_name at_rule_header_end_maybe_space '{' at_rule_body_start maybe_space keyframes_rule closing_brace {
$$ = parser->createKeyframesRule($4, parser->sinkFloatingKeyframeVector($9));
}
+ | before_keyframes_rule WEBKIT_KEYFRAMES_SYM at_rule_recovery {
+ $$ = 0;
+ parser->endRuleBody(true);
+ }
;
keyframe_name:
@@ -814,51 +821,61 @@
;
keyframes_rule:
- /* empty */ { $$ = parser->createFloatingKeyframeVector(); }
- | keyframes_rule keyframe_rule maybe_space {
+ keyframe_rule_list
+ | keyframe_rule_list keyframes_error_recovery {
+ parser->clearProperties();
+ };
+
+keyframe_rule_list:
+ /* empty */ {
+ $$ = parser->createFloatingKeyframeVector();
+ }
+ | keyframe_rule_list keyframe_rule maybe_space {
$$ = $1;
if ($2)
$$->append($2);
}
+ | keyframe_rule_list keyframes_error_recovery invalid_block {
+ parser->clearProperties();
+ }
;
keyframe_rule:
- key_list maybe_space '{' maybe_space declaration_list closing_brace {
+ key_list '{' maybe_space declaration_list closing_brace {
$$ = parser->createKeyframe($1);
}
;
key_list:
- key {
+ key maybe_space {
$$ = parser->createFloatingValueList();
$$->addValue(parser->sinkFloatingValue($1));
}
- | key_list maybe_space ',' maybe_space key {
+ | key_list ',' maybe_space key maybe_space {
$$ = $1;
if ($$)
- $$->addValue(parser->sinkFloatingValue($5));
+ $$->addValue(parser->sinkFloatingValue($4));
}
;
key:
- maybe_unary_operator PERCENTAGE { $$.id = 0; $$.isInt = false; $$.fValue = $1 * $2; $$.unit = CSSPrimitiveValue::CSS_NUMBER; }
+ maybe_unary_operator PERCENTAGE {
+ $$.setFromNumber($1 * $2);
+ }
| IDENT {
- $$.id = 0; $$.isInt = false; $$.unit = CSSPrimitiveValue::CSS_NUMBER;
- CSSParserString& str = $1;
- if (str.equalIgnoringCase("from"))
- $$.fValue = 0;
- else if (str.equalIgnoringCase("to"))
- $$.fValue = 100;
+ if ($1.equalIgnoringCase("from"))
+ $$.setFromNumber(0);
+ else if ($1.equalIgnoringCase("to"))
+ $$.setFromNumber(100);
else {
- $$.unit = 0;
YYERROR;
}
}
- | error {
- $$.unit = 0;
- }
;
+keyframes_error_recovery:
+ error rule_error_recovery;
+
before_page_rule:
/* empty */ {
parser->startRuleHeader(CSSRuleSourceData::PAGE_RULE);
@@ -878,11 +895,7 @@
parser->endRuleBody(true);
}
}
- | before_page_rule PAGE_SYM error invalid_block {
- parser->endRuleBody(true);
- $$ = 0;
- }
- | before_page_rule PAGE_SYM error ';' {
+ | before_page_rule PAGE_SYM at_rule_recovery {
parser->endRuleBody(true);
$$ = 0;
}
@@ -986,11 +999,7 @@
'{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
$$ = parser->createFontFaceRule();
}
- | before_font_face_rule FONT_FACE_SYM error invalid_block {
- $$ = 0;
- parser->endRuleBody(true);
- }
- | before_font_face_rule FONT_FACE_SYM error ';' {
+ | before_font_face_rule FONT_FACE_SYM at_rule_recovery {
$$ = 0;
parser->endRuleBody(true);
}
@@ -1004,10 +1013,10 @@
host:
before_host_rule HOST_SYM at_rule_header_end_maybe_space
- '{' at_rule_body_start maybe_space block_rule_list save_block {
+ '{' at_rule_body_start maybe_space block_rule_body closing_brace {
$$ = parser->createHostRule($7);
}
- | before_host_rule HOST_SYM at_rule_header_end_maybe_space ';' {
+ | before_host_rule HOST_SYM at_rule_recovery {
$$ = 0;
parser->endRuleBody(true);
}
@@ -1027,12 +1036,7 @@
$$ = parser->createViewportRule();
parser->markViewportRuleBodyEnd();
}
- | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error invalid_block {
- $$ = 0;
- parser->endRuleBody(true);
- parser->markViewportRuleBodyEnd();
- }
- | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM error ';' {
+ | before_viewport_rule WEBKIT_VIEWPORT_RULE_SYM at_rule_recovery {
$$ = 0;
parser->endRuleBody(true);
parser->markViewportRuleBodyEnd();
@@ -1058,7 +1062,7 @@
;
region:
- before_region_rule WEBKIT_REGION_RULE_SYM WHITESPACE region_selector at_rule_header_end '{' at_rule_body_start maybe_space region_block_rule_list save_block {
+ before_region_rule WEBKIT_REGION_RULE_SYM WHITESPACE region_selector at_rule_header_end '{' at_rule_body_start maybe_space region_block_rule_body closing_brace {
if ($4)
$$ = parser->createRegionRule($4, $9);
else {
@@ -1066,6 +1070,10 @@
parser->endRuleBody(true);
}
}
+ | before_region_rule WEBKIT_REGION_RULE_SYM at_rule_recovery {
+ $$ = 0;
+ parser->endRuleBody(true);
+ }
;
before_filter_rule:
@@ -1152,11 +1160,21 @@
} else
$$ = 0;
}
- | selector_list error {
- $$ = 0;
- }
;
+relative_selector:
+ combinator selector {
+ $$ = $2;
+ CSSParserSelector* end = $$;
+ while (end->tagHistory())
+ end = end->tagHistory();
+ end->setRelation($1);
+ }
+ | selector {
+ $$ = $1;
+ }
+ ;
+
selector_with_trailing_whitespace:
selector WHITESPACE {
$$ = $1;
@@ -1196,9 +1214,6 @@
end->setTagHistory(parser->sinkFloatingSelector($1));
}
}
- | selector error {
- $$ = 0;
- }
;
namespace_selector:
@@ -1251,17 +1266,13 @@
} else
$$ = 0;
}
- | simple_selector_list error {
- $$ = 0;
- }
;
element_name:
IDENT {
- CSSParserString& str = $1;
if (parser->m_context.isHTMLDocument)
- str.lower();
- $$ = str;
+ parser->tokenToLowerCase($1);
+ $$ = $1;
}
| '*' {
static LChar star = '*';
@@ -1279,9 +1290,6 @@
else if ($1)
$$ = parser->rewriteSpecifiers($1, $2);
}
- | specifier_list error {
- $$ = 0;
- }
;
specifier:
@@ -1289,7 +1297,7 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::Id);
if (parser->m_context.mode == CSSQuirksMode)
- $1.lower();
+ parser->tokenToLowerCase($1);
$$->setValue($1);
}
| HEX {
@@ -1299,7 +1307,7 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::Id);
if (parser->m_context.mode == CSSQuirksMode)
- $1.lower();
+ parser->tokenToLowerCase($1);
$$->setValue($1);
}
}
@@ -1313,17 +1321,16 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::Class);
if (parser->m_context.mode == CSSQuirksMode)
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
}
;
attr_name:
IDENT maybe_space {
- CSSParserString& str = $1;
if (parser->m_context.isHTMLDocument)
- str.lower();
- $$ = str;
+ parser->tokenToLowerCase($1);
+ $$ = $1;
}
;
@@ -1350,6 +1357,9 @@
$$->setMatch((CSSSelector::Match)$5);
$$->setValue($7);
}
+ | '[' selector_recovery ']' {
+ YYERROR;
+ }
;
match:
@@ -1382,7 +1392,7 @@
':' IDENT {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PagePseudoClass);
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
CSSSelector::PseudoType type = $$->pseudoType();
if (type == CSSSelector::PseudoUnknown)
@@ -1393,7 +1403,7 @@
':' IDENT {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
CSSSelector::PseudoType type = $$->pseudoType();
if (type == CSSSelector::PseudoUnknown)
@@ -1402,7 +1412,7 @@
| ':' ':' IDENT {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoElement);
- $3.lower();
+ parser->tokenToLowerCase($3);
$$->setValue($3);
// FIXME: This call is needed to force selector to compute the pseudoType early enough.
CSSSelector::PseudoType type = $$->pseudoType();
@@ -1422,17 +1432,23 @@
} else
$$ = 0;
}
- | ':' ':' DISTRIBUTEDFUNCTION maybe_space selector maybe_space ')' {
+ | ':' ':' CUEFUNCTION selector_recovery ')' {
+ YYERROR;
+ }
+ | ':' ':' DISTRIBUTEDFUNCTION maybe_space relative_selector maybe_space ')' {
if (!$5)
$$ = 0;
else {
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoElement);
$$->setFunctionArgumentSelector($5);
- $3.lower();
+ parser->tokenToLowerCase($3);
$$->setValue($3);
}
}
+ | ':' ':' DISTRIBUTEDFUNCTION selector_recovery ')' {
+ YYERROR;
+ }
// use by :-webkit-any.
// FIXME: should we support generic selectors here or just simple_selectors?
// Use simple_selector_list for now to match -moz-any.
@@ -1443,7 +1459,7 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4));
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
CSSSelector::PseudoType type = $$->pseudoType();
if (type != CSSSelector::PseudoAny)
@@ -1451,6 +1467,9 @@
} else
$$ = 0;
}
+ | ':' ANYFUNCTION selector_recovery ')' {
+ YYERROR;
+ }
// used by :nth-*(ax+b)
| ':' FUNCTION maybe_space NTH maybe_space ')' {
$$ = parser->createFloatingSelector();
@@ -1476,7 +1495,7 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
$$->setArgument($4);
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
CSSSelector::PseudoType type = $$->pseudoType();
if (type == CSSSelector::PseudoUnknown)
@@ -1489,6 +1508,9 @@
$$ = 0;
}
}
+ | ':' FUNCTION selector_recovery ')' {
+ YYERROR;
+ }
// used by :not
| ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' {
if (!$4 || !$4->isSimple())
@@ -1501,12 +1523,18 @@
selectorVector.append(parser->sinkFloatingSelector($4));
$$->adoptSelectorVector(selectorVector);
- $2.lower();
+ parser->tokenToLowerCase($2);
$$->setValue($2);
}
}
+ | ':' NOTFUNCTION selector_recovery ')' {
+ YYERROR;
+ }
;
+selector_recovery:
+ error error_location error_recovery;
+
declaration_list:
/* empty */ { $$ = false; }
| declaration {
@@ -1551,39 +1579,40 @@
decl_list_recovery:
error error_location error_recovery {
- parser->syntaxError($2, CSSParser::PropertyDeclarationError);
+ parser->reportError($2, CSSParser::PropertyDeclarationError);
}
;
declaration:
- VAR_DEFINITION ':' maybe_space expr prio {
- parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($4), $5);
+ VAR_DEFINITION maybe_space ':' maybe_space expr prio {
+ parser->storeVariableDeclaration($1, parser->sinkFloatingValueList($5), $6);
$$ = true;
- parser->endProperty($5, true);
+ parser->endProperty($6, true);
}
|
- property ':' maybe_space expr prio {
+ property ':' maybe_space error_location expr prio {
$$ = false;
bool isPropertyParsed = false;
- if ($1 && $4) {
- parser->m_valueList = parser->sinkFloatingValueList($4);
+ if ($1 && $5) {
+ parser->m_valueList = parser->sinkFloatingValueList($5);
int oldParsedProperties = parser->m_parsedProperties.size();
- $$ = parser->parseValue(static_cast<CSSPropertyID>($1), $5);
- if (!$$)
+ $$ = parser->parseValue(static_cast<CSSPropertyID>($1), $6);
+ if (!$$) {
parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
- else
+ parser->reportError($4, CSSParser::InvalidPropertyValueError);
+ } else
isPropertyParsed = true;
parser->m_valueList = nullptr;
}
- parser->endProperty($5, isPropertyParsed);
+ parser->endProperty($6, isPropertyParsed);
}
|
property declaration_recovery {
- parser->endProperty(false, false, CSSParser::GeneralSyntaxError);
+ parser->endProperty(false, false, CSSParser::GeneralError);
$$ = false;
}
|
- property ':' maybe_space expr prio declaration_recovery {
+ property ':' maybe_space error_location expr prio declaration_recovery {
/* When we encounter something like p {color: red !important fail;} we should drop the declaration */
parser->endProperty(false, false);
$$ = false;
@@ -1591,7 +1620,7 @@
|
IMPORTANT_SYM maybe_space declaration_recovery {
/* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */
- parser->endProperty(false, false, CSSParser::GeneralSyntaxError);
+ parser->endProperty(false, false, CSSParser::GeneralError);
$$ = false;
}
|
@@ -1604,13 +1633,16 @@
declaration_recovery:
error error_location error_recovery {
- parser->syntaxError($2);
+ parser->reportError($2);
}
;
property:
- IDENT maybe_space {
- $$ = cssPropertyID($1);
+ error_location IDENT maybe_space {
+ $$ = cssPropertyID($2);
+ parser->setCurrentProperty($$);
+ if ($$ == CSSPropertyInvalid)
+ parser->reportError($1, CSSParser::InvalidPropertyError);
}
;
@@ -1645,7 +1677,9 @@
;
expr_recovery:
- error error_location error_recovery
+ error error_location error_recovery {
+ parser->reportError($2, CSSParser::PropertyDeclarationError);
+ }
;
operator:
@@ -1697,52 +1731,53 @@
;
unary_term:
- INTEGER { $$.id = 0; $$.isInt = true; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_NUMBER; }
- | FLOATTOKEN { $$.id = 0; $$.isInt = false; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_NUMBER; }
- | PERCENTAGE { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_PERCENTAGE; }
- | PXS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_PX; }
- | CMS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_CM; }
- | MMS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_MM; }
- | INS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_IN; }
- | PTS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_PT; }
- | PCS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_PC; }
- | DEGS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DEG; }
- | RADS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_RAD; }
- | GRADS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_GRAD; }
- | TURNS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_TURN; }
- | MSECS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_MS; }
- | SECS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_S; }
- | HERTZ { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_HZ; }
- | KHERTZ { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_KHZ; }
- | EMS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_EMS; }
- | QEMS { $$.id = 0; $$.fValue = $1; $$.unit = CSSParserValue::Q_EMS; }
- | EXS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_EXS; }
+ INTEGER { $$.setFromNumber($1); $$.isInt = true; }
+ | FLOATTOKEN { $$.setFromNumber($1); }
+ | PERCENTAGE { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PERCENTAGE); }
+ | PXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PX); }
+ | CMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CM); }
+ | MMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MM); }
+ | INS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_IN); }
+ | PTS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PT); }
+ | PCS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_PC); }
+ | DEGS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DEG); }
+ | RADS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_RAD); }
+ | GRADS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_GRAD); }
+ | TURNS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_TURN); }
+ | MSECS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_MS); }
+ | SECS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_S); }
+ | HERTZ { $$.setFromNumber($1, CSSPrimitiveValue::CSS_HZ); }
+ | KHERTZ { $$.setFromNumber($1, CSSPrimitiveValue::CSS_KHZ); }
+ | EMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EMS); }
+ | QEMS { $$.setFromNumber($1, CSSParserValue::Q_EMS); }
+ | EXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EXS); }
| REMS {
- $$.id = 0;
- $$.fValue = $1;
- $$.unit = CSSPrimitiveValue::CSS_REMS;
+ $$.setFromNumber($1, CSSPrimitiveValue::CSS_REMS);
if (parser->m_styleSheet)
parser->m_styleSheet->parserSetUsesRemUnits(true);
}
- | CHS { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_CHS; }
- | VW { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VW; }
- | VH { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
- | VMIN { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
- | VMAX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; }
- | DPPX { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
- | DPI { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; }
- | DPCM { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; }
- | FR { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; }
+ | CHS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CHS); }
+ | VW { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VW); }
+ | VH { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VH); }
+ | VMIN { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VMIN); }
+ | VMAX { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VMAX); }
+ | DPPX { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPPX); }
+ | DPI { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPI); }
+ | DPCM { $$.setFromNumber($1, CSSPrimitiveValue::CSS_DPCM); }
+ | FR { $$.setFromNumber($1, CSSPrimitiveValue::CSS_FR); }
;
function:
FUNCTION maybe_space expr closing_parenthesis {
- CSSParserFunction* f = parser->createFloatingFunction();
- f->name = $1;
- f->args = parser->sinkFloatingValueList($3);
- $$.id = 0;
- $$.unit = CSSParserValue::Function;
- $$.function = f;
+ if ($3) {
+ CSSParserFunction* f = parser->createFloatingFunction();
+ f->name = $1;
+ f->args = parser->sinkFloatingValueList($3);
+ $$.id = 0;
+ $$.unit = CSSParserValue::Function;
+ $$.function = f;
+ } else
+ YYERROR;
} |
FUNCTION maybe_space closing_parenthesis {
CSSParserFunction* f = parser->createFloatingFunction();
@@ -1754,13 +1789,8 @@
$$.function = f;
} |
FUNCTION maybe_space expr_recovery closing_parenthesis {
- CSSParserFunction* f = parser->createFloatingFunction();
- f->name = $1;
- f->args = nullptr;
- $$.id = 0;
- $$.unit = CSSParserValue::Function;
- $$.function = f;
- }
+ YYERROR;
+ }
;
calc_func_term:
@@ -1805,7 +1835,7 @@
v.iValue = ')';
$$->addValue(v);
} else
- $$ = 0;
+ YYERROR;
}
| '(' maybe_space expr_recovery closing_parenthesis {
YYERROR;
@@ -1832,7 +1862,7 @@
$$->addValue(v);
$$->addValue(parser->sinkFloatingValue($3));
} else
- $$ = 0;
+ YYERROR;
}
| calc_func_expr calc_func_operator calc_func_paren_expr {
@@ -1845,7 +1875,7 @@
$$->addValue(v);
$$->extend(*($3));
} else
- $$ = 0;
+ YYERROR;
}
| calc_func_paren_expr
;
@@ -1864,7 +1894,7 @@
$$->addValue(v);
$$->extend(*($4));
} else
- $$ = 0;
+ YYERROR;
}
;
@@ -1906,57 +1936,52 @@
}
;
-/* error handling rules */
-
-save_block:
- closing_brace {
+invalid_at:
+ ATKEYWORD at_rule_recovery {
$$ = 0;
}
- | error closing_brace {
+ | margin_sym at_rule_recovery {
$$ = 0;
}
;
-invalid_at:
- ATKEYWORD error invalid_block {
- $$ = 0;
- }
- | ATKEYWORD error ';' {
- $$ = 0;
- }
+at_rule_recovery:
+ error rule_error_recovery at_rule_end;
+
+at_rule_end:
+ at_invalid_rule_header_end ';'
+ | at_invalid_rule_header_end invalid_block
;
invalid_rule:
- error invalid_block {
+ error rule_error_recovery at_invalid_rule_header_end invalid_block {
$$ = 0;
}
-
-/*
- Seems like the two rules below are trying too much and violating
- http://www.hixie.ch/tests/evil/mixed/csserrorhandling.html
-
- | error ';' {
- $$ = 0;
- }
- | error '}' {
- $$ = 0;
- }
-*/
;
+at_invalid_rule_header_end:
+ /* empty */ {
+ parser->endInvalidRuleHeader();
+ }
+ ;
+
invalid_block:
- '{' error invalid_block_list error closing_brace {
- parser->invalidBlockHit();
- }
- | '{' error closing_brace {
+ '{' error_recovery closing_brace {
parser->invalidBlockHit();
}
;
-invalid_block_list:
- invalid_block
- | invalid_block_list error invalid_block
-;
+invalid_square_brackets_block:
+ '[' error_recovery ']'
+ | '[' error_recovery TOKEN_EOF
+ ;
+
+invalid_parentheses_block:
+ opening_parenthesis error_recovery closing_parenthesis;
+
+opening_parenthesis:
+ '(' | FUNCTION | CALCFUNCTION | VARFUNCTION | MINFUNCTION | MAXFUNCTION | ANYFUNCTION | NOTFUNCTION | CUEFUNCTION | DISTRIBUTEDFUNCTION
+ ;
error_location: {
$$ = parser->currentLocation();
@@ -1966,17 +1991,16 @@
error_recovery:
/* empty */
| error_recovery error
- | error_recovery '{' error_recovery closing_brace { parser->invalidBlockHit(); }
- | error_recovery '[' error_recovery ']'
- | error_recovery '[' error_recovery TOKEN_EOF
- | error_recovery '(' error_recovery closing_parenthesis
- | error_recovery FUNCTION error_recovery closing_parenthesis
- | error_recovery CALCFUNCTION error_recovery closing_parenthesis
- | error_recovery VARFUNCTION error_recovery closing_parenthesis
- | error_recovery MINFUNCTION error_recovery closing_parenthesis
- | error_recovery MAXFUNCTION error_recovery closing_parenthesis
- | error_recovery ANYFUNCTION error_recovery closing_parenthesis
- | error_recovery NOTFUNCTION error_recovery closing_parenthesis
+ | error_recovery invalid_block
+ | error_recovery invalid_square_brackets_block
+ | error_recovery invalid_parentheses_block
+ ;
+
+rule_error_recovery:
+ /* empty */
+ | rule_error_recovery error
+ | rule_error_recovery invalid_square_brackets_block
+ | rule_error_recovery invalid_parentheses_block
;
%%
diff --git a/Source/core/css/CSSGroupingRule.cpp b/Source/core/css/CSSGroupingRule.cpp
index f079f58..90b5256 100644
--- a/Source/core/css/CSSGroupingRule.cpp
+++ b/Source/core/css/CSSGroupingRule.cpp
@@ -69,8 +69,8 @@
return 0;
}
- CSSParser parser(parserContext());
CSSStyleSheet* styleSheet = parentStyleSheet();
+ CSSParser parser(parserContext(), UseCounter::getFrom(styleSheet));
RefPtr<StyleRuleBase> newRule = parser.parseRule(styleSheet ? styleSheet->contents() : 0, ruleString);
if (!newRule) {
// SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable.
diff --git a/Source/core/css/CSSImageGeneratorValue.cpp b/Source/core/css/CSSImageGeneratorValue.cpp
index a4aee0b..a9f5eb6 100644
--- a/Source/core/css/CSSImageGeneratorValue.cpp
+++ b/Source/core/css/CSSImageGeneratorValue.cpp
@@ -31,7 +31,6 @@
#include "core/css/CSSGradientValue.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/platform/graphics/Image.h"
-#include "core/rendering/RenderObject.h"
#include <wtf/MemoryInstrumentationHashCountedSet.h>
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/text/WTFString.h>
diff --git a/Source/core/css/CSSImageSetValue.cpp b/Source/core/css/CSSImageSetValue.cpp
index 0697566..1353606 100644
--- a/Source/core/css/CSSImageSetValue.cpp
+++ b/Source/core/css/CSSImageSetValue.cpp
@@ -108,8 +108,7 @@
// All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(),
// and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
ImageWithScale image = bestImageForScaleFactor();
- CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)));
- request.setInitiator(cachedResourceRequestInitiators().css);
+ CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), cachedResourceRequestInitiators().css);
if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request)) {
m_imageSet = StyleCachedImageSet::create(cachedImage.get(), image.scaleFactor, this);
m_accessedBestFitImage = true;
diff --git a/Source/core/css/CSSImageValue.cpp b/Source/core/css/CSSImageValue.cpp
index 21117e1..9ee0508 100644
--- a/Source/core/css/CSSImageValue.cpp
+++ b/Source/core/css/CSSImageValue.cpp
@@ -21,17 +21,13 @@
#include "config.h"
#include "core/css/CSSImageValue.h"
-#include "CSSValueKeywords.h"
-#include "core/css/CSSCursorImageValue.h"
#include "core/css/CSSParser.h"
#include "core/dom/Document.h"
-#include "core/dom/Element.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/loader/cache/CachedImage.h"
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
#include "core/loader/cache/CachedResourceRequestInitiators.h"
-#include "core/loader/cache/MemoryCache.h"
#include "core/rendering/style/StyleCachedImage.h"
#include "core/rendering/style/StylePendingImage.h"
@@ -71,11 +67,7 @@
if (!m_accessedImage) {
m_accessedImage = true;
- CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)));
- if (m_initiatorName.isEmpty())
- request.setInitiator(cachedResourceRequestInitiators().css);
- else
- request.setInitiator(m_initiatorName);
+ CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), m_initiatorName.isEmpty() ? cachedResourceRequestInitiators().css : m_initiatorName);
if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request))
m_image = StyleCachedImage::create(cachedImage.get());
}
diff --git a/Source/core/css/CSSImportRule.cpp b/Source/core/css/CSSImportRule.cpp
index c1e685d..c728b8b 100644
--- a/Source/core/css/CSSImportRule.cpp
+++ b/Source/core/css/CSSImportRule.cpp
@@ -27,11 +27,7 @@
#include "core/css/MediaList.h"
#include "core/css/StyleRuleImport.h"
#include "core/css/StyleSheetContents.h"
-#include "core/dom/Document.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/loader/cache/CachedCSSStyleSheet.h"
-#include "core/loader/cache/CachedResourceLoader.h"
-#include "weborigin/SecurityOrigin.h"
namespace WebCore {
diff --git a/Source/core/css/CSSLineBoxContainValue.cpp b/Source/core/css/CSSLineBoxContainValue.cpp
index 15d7dde..710c2eb 100644
--- a/Source/core/css/CSSLineBoxContainValue.cpp
+++ b/Source/core/css/CSSLineBoxContainValue.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "core/css/CSSLineBoxContainValue.h"
-#include "core/css/CSSPrimitiveValue.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
diff --git a/Source/core/css/CSSMediaRule.cpp b/Source/core/css/CSSMediaRule.cpp
index 2f5e060..c9b3548 100644
--- a/Source/core/css/CSSMediaRule.cpp
+++ b/Source/core/css/CSSMediaRule.cpp
@@ -23,11 +23,7 @@
#include "config.h"
#include "core/css/CSSMediaRule.h"
-#include "core/css/CSSParser.h"
-#include "core/css/CSSRuleList.h"
-#include "core/css/CSSStyleSheet.h"
#include "core/css/StyleRule.h"
-#include "core/dom/ExceptionCode.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSPageRule.cpp b/Source/core/css/CSSPageRule.cpp
index 8804416..c13ba3a 100644
--- a/Source/core/css/CSSPageRule.cpp
+++ b/Source/core/css/CSSPageRule.cpp
@@ -28,7 +28,6 @@
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
-#include "core/dom/Document.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/Vector.h>
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index ee0e627..8b9845c 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -35,17 +35,13 @@
#include "core/css/CSSCanvasValue.h"
#include "core/css/CSSCrossfadeValue.h"
#include "core/css/CSSCursorImageValue.h"
-#include "core/css/CSSFontFaceRule.h"
#include "core/css/CSSFontFaceSrcValue.h"
-#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGradientValue.h"
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSImageValue.h"
#include "core/css/CSSInheritedValue.h"
#include "core/css/CSSInitialValue.h"
#include "core/css/CSSLineBoxContainValue.h"
-#include "core/css/CSSMediaRule.h"
-#include "core/css/CSSPageRule.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSPropertySourceData.h"
#include "core/css/CSSReflectValue.h"
@@ -58,7 +54,6 @@
#include "core/css/CSSVariableValue.h"
#include "core/css/Counter.h"
#include "core/css/FontFeatureValue.h"
-#include "core/css/FontValue.h"
#include "core/css/MediaList.h"
#include "core/css/MediaQueryExp.h"
#include "core/css/Pair.h"
@@ -74,7 +69,7 @@
#include "core/css/WebKitCSSKeyframeRule.h"
#include "core/css/WebKitCSSKeyframesRule.h"
#include "core/css/WebKitCSSMixFunctionValue.h"
-#include "core/css/WebKitCSSRegionRule.h"
+#include "core/css/WebKitCSSSVGDocumentValue.h"
#include "core/css/WebKitCSSShaderValue.h"
#include "core/css/WebKitCSSTransformValue.h"
#include "core/dom/Document.h"
@@ -90,17 +85,12 @@
#include "core/svg/SVGParserUtilities.h"
#include "wtf/BitArray.h"
#include "wtf/HexNumber.h"
-#include "wtf/dtoa.h"
#include "wtf/text/StringBuffer.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/text/StringImpl.h"
#include "wtf/text/TextEncoding.h"
#include <limits.h>
-#if ENABLE(SVG)
-#include "core/css/WebKitCSSSVGDocumentValue.h"
-#endif
-
#define YYDEBUG 0
#if YYDEBUG > 0
@@ -112,33 +102,6 @@
using namespace std;
using namespace WTF;
-namespace {
-
-enum PropertyType {
- PropertyExplicit,
- PropertyImplicit
-};
-
-class ImplicitScope {
- WTF_MAKE_NONCOPYABLE(ImplicitScope);
-public:
- ImplicitScope(WebCore::CSSParser* parser, PropertyType propertyType)
- : m_parser(parser)
- {
- m_parser->m_implicitShorthand = propertyType == PropertyImplicit;
- }
-
- ~ImplicitScope()
- {
- m_parser->m_implicitShorthand = false;
- }
-
-private:
- WebCore::CSSParser* m_parser;
-};
-
-} // namespace
-
namespace WebCore {
static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX;
@@ -245,7 +208,6 @@
, isCSSCustomFilterEnabled(false)
, isCSSStickyPositionEnabled(false)
, isCSSGridLayoutEnabled(false)
- , isCSSVariablesEnabled(false)
, needsSiteSpecificQuirks(false)
{
}
@@ -258,7 +220,6 @@
, isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCSSCustomFilterEnabled() : false)
, isCSSStickyPositionEnabled(document->cssStickyPositionEnabled())
, isCSSGridLayoutEnabled(document->cssGridLayoutEnabled())
- , isCSSVariablesEnabled(document->settings() ? document->settings()->cssVariablesEnabled() : false)
, needsSiteSpecificQuirks(document->settings() ? document->settings()->needsSiteSpecificQuirks() : false)
{
}
@@ -272,11 +233,10 @@
&& a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled
&& a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled
&& a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled
- && a.isCSSVariablesEnabled == b.isCSSVariablesEnabled
&& a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks;
}
-CSSParser::CSSParser(const CSSParserContext& context)
+CSSParser::CSSParser(const CSSParserContext& context, UseCounter* counter)
: m_context(context)
, m_important(false)
, m_id(CSSPropertyInvalid)
@@ -290,7 +250,7 @@
, m_hasFontFaceOnlyValues(false)
, m_hadSyntacticallyValidCSSRule(false)
, m_logErrors(false)
- , m_ignoreErrorsInDeclaration(false)
+ , m_ignoreErrors(false)
, m_inFilterRule(false)
, m_defaultNamespace(starAtom)
, m_parsedTextPrefixLength(0)
@@ -300,16 +260,19 @@
, m_is8BitSource(false)
, m_currentCharacter8(0)
, m_currentCharacter16(0)
+ , m_source(0)
, m_length(0)
, m_token(0)
, m_lineNumber(0)
, m_tokenStartLineNumber(0)
, m_lastSelectorLineNumber(0)
+ , m_ruleHeaderType(CSSRuleSourceData::UNKNOWN_RULE)
, m_allowImportRules(true)
, m_allowNamespaceDeclarations(true)
#if ENABLE(CSS_DEVICE_ADAPTATION)
, m_inViewport(false)
#endif
+ , m_useCounter(counter)
{
#if YYDEBUG > 0
cssyydebug = 1;
@@ -328,51 +291,24 @@
deleteAllValues(m_floatingFunctions);
}
-template <typename CharacterType>
-ALWAYS_INLINE static void makeLower(const CharacterType* input, CharacterType* output, unsigned length)
-{
- // FIXME: If we need Unicode lowercasing here, then we probably want the real kind
- // that can potentially change the length of the string rather than the character
- // by character kind. If we don't need Unicode lowercasing, it would be good to
- // simplify this function.
-
- if (charactersAreAllASCII(input, length)) {
- // Fast case for all-ASCII.
- for (unsigned i = 0; i < length; i++)
- output[i] = toASCIILower(input[i]);
- } else {
- for (unsigned i = 0; i < length; i++)
- output[i] = Unicode::toLower(input[i]);
- }
-}
-
-void CSSParserString::lower()
-{
- if (is8Bit()) {
- makeLower(characters8(), characters8(), length());
- return;
- }
-
- makeLower(characters16(), characters16(), length());
-}
-
-AtomicString CSSParserString::lowerSubstring(unsigned position, unsigned length) const
+AtomicString CSSParserString::atomicSubstring(unsigned position, unsigned length) const
{
ASSERT(m_length >= position + length);
- RefPtr<StringImpl> result;
+ if (is8Bit())
+ return AtomicString(characters8() + position, length);
+ return AtomicString(characters16() + position, length);
+}
+void CSSParserString::trimTrailingWhitespace()
+{
if (is8Bit()) {
- LChar* buffer;
- result = StringImpl::createUninitialized(length, buffer);
- makeLower(characters8() + position, buffer, length);
+ while (m_length > 0 && isHTMLSpace(m_data.characters8[m_length - 1]))
+ --m_length;
} else {
- UChar* buffer = 0;
- result = StringImpl::createUninitialized(length, buffer);
- makeLower(characters16() + position, buffer, length);
+ while (m_length > 0 && isHTMLSpace(m_data.characters16[m_length - 1]))
+ --m_length;
}
-
- return AtomicString(result);
}
void CSSParser::setupParser(const char* prefix, unsigned prefixLength, const String& string, const char* suffix, unsigned suffixLength)
@@ -432,14 +368,16 @@
m_defaultNamespace = starAtom; // Reset the default namespace.
m_sourceDataHandler = sourceDataHandler;
m_logErrors = logErrors && sheet->singleOwnerDocument() && !sheet->baseURL().isEmpty() && sheet->singleOwnerDocument()->page();
- m_ignoreErrorsInDeclaration = false;
+ m_ignoreErrors = false;
m_lineNumber = startLineNumber;
+ m_source = &string;
setupParser("", string, "");
cssyyparse(this);
sheet->shrinkToFit();
+ m_source = 0;
m_sourceDataHandler = 0;
m_rule = 0;
- m_ignoreErrorsInDeclaration = false;
+ m_ignoreErrors = false;
m_logErrors = false;
}
@@ -498,7 +436,7 @@
}
}
-static bool parseColorValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
+static bool parseColorValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
{
ASSERT(!string.isEmpty());
bool strict = isStrictParserMode(cssParserMode);
@@ -594,7 +532,7 @@
return ok;
}
-static bool parseSimpleLengthValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
+static bool parseSimpleLengthValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode)
{
ASSERT(!string.isEmpty());
bool acceptsNegativeNumbers;
@@ -779,6 +717,10 @@
if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || valueID == CSSValueNone)
return true;
break;
+ case CSSPropertyTouchAction: // auto | none
+ if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSValueAuto || valueID == CSSValueNone))
+ return true;
+ break;
case CSSPropertyVisibility: // visible | hidden | collapse | inherit
if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueCollapse)
return true;
@@ -1041,6 +983,7 @@
case CSSPropertyTextTransform:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
+ case CSSPropertyTouchAction:
case CSSPropertyVisibility:
case CSSPropertyWebkitAppearance:
case CSSPropertyWebkitBackfaceVisibility:
@@ -1111,7 +1054,7 @@
}
}
-static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext)
+static bool parseKeywordValue(MutableStylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, const CSSParserContext& parserContext)
{
ASSERT(!string.isEmpty());
@@ -1168,7 +1111,7 @@
return true;
}
-static bool parseTranslateTransformValue(StylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important)
+static bool parseTranslateTransformValue(MutableStylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important)
{
if (propertyID != CSSPropertyWebkitTransform)
return false;
@@ -1219,13 +1162,13 @@
{
if (string.isEmpty())
return 0;
- RefPtr<StylePropertySet> dummyStyle = StylePropertySet::create();
+ RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::create();
if (!parseValue(dummyStyle.get(), CSSPropertyFontFamily, string, false, CSSQuirksMode, 0))
return 0;
return static_pointer_cast<CSSValueList>(dummyStyle->getPropertyCSSValue(CSSPropertyFontFamily));
}
-bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, Document* document)
+bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, Document* document)
{
ASSERT(!string.isEmpty());
@@ -1238,11 +1181,11 @@
if (parseKeywordValue(declaration, propertyID, string, important, context))
return true;
- CSSParser parser(context);
+ CSSParser parser(context, UseCounter::getFrom(document));
return parser.parseValue(declaration, propertyID, string, important, static_cast<StyleSheetContents*>(0));
}
-bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
+bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
{
ASSERT(!string.isEmpty());
if (parseSimpleLengthValue(declaration, propertyID, string, important, cssParserMode))
@@ -1265,10 +1208,13 @@
return parser.parseValue(declaration, propertyID, string, important, contextStyleSheet);
}
-bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet)
+bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, StyleSheetContents* contextStyleSheet)
{
// FIXME: Check RuntimeCSSEnabled::isPropertyEnabled or isValueEnabledForProperty.
+ if (m_useCounter)
+ m_useCounter->count(propertyID);
+
setStyleSheet(contextStyleSheet);
setupParser("@-internal-value{", string, "} ");
@@ -1279,6 +1225,7 @@
cssyyparse(this);
m_rule = 0;
+ m_id = CSSPropertyInvalid;
bool ok = false;
if (m_hasFontFaceOnlyValues)
@@ -1353,14 +1300,15 @@
m_selectorListForParseSelector = 0;
}
-PassRefPtr<StylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& string, Element* element)
+PassRefPtr<ImmutableStylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& string, Element* element)
{
- CSSParserContext context = element->document()->elementSheet()->contents()->parserContext();
- context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode());
- return CSSParser(context).parseDeclaration(string, element->document()->elementSheet()->contents());
+ Document* document = element->document();
+ CSSParserContext context = document->elementSheet()->contents()->parserContext();
+ context.mode = strictToCSSParserMode(element->isHTMLElement() && !document->inQuirksMode());
+ return CSSParser(context, UseCounter::getFrom(document)).parseDeclaration(string, document->elementSheet()->contents());
}
-PassRefPtr<StylePropertySet> CSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet)
+PassRefPtr<ImmutableStylePropertySet> CSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet)
{
setStyleSheet(contextStyleSheet);
@@ -1371,13 +1319,13 @@
if (m_hasFontFaceOnlyValues)
deleteFontFaceOnlyValues();
- RefPtr<StylePropertySet> style = createStylePropertySet();
+ RefPtr<ImmutableStylePropertySet> style = createStylePropertySet();
clearProperties();
return style.release();
}
-bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, SourceDataHandler* sourceDataHandler, StyleSheetContents* contextStyleSheet)
+bool CSSParser::parseDeclaration(MutableStylePropertySet* declaration, const String& string, SourceDataHandler* sourceDataHandler, StyleSheetContents* contextStyleSheet)
{
setStyleSheet(contextStyleSheet);
@@ -1446,7 +1394,7 @@
}
}
-PassRefPtr<StylePropertySet> CSSParser::createStylePropertySet()
+PassRefPtr<ImmutableStylePropertySet> CSSParser::createStylePropertySet()
{
BitArray<numCSSProperties> seenProperties;
size_t unusedEntries = m_parsedProperties.size();
@@ -1459,7 +1407,7 @@
if (unusedEntries)
results.remove(0, unusedEntries);
- return StylePropertySet::createImmutable(results.data(), results.size(), m_context.mode);
+ return ImmutableStylePropertySet::create(results.data(), results.size(), m_context.mode);
}
void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
@@ -1648,8 +1596,7 @@
inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveVariableNameValue(CSSParserValue* value)
{
ASSERT(value->unit == CSSPrimitiveValue::CSS_VARIABLE_NAME);
- AtomicString variableName = String(value->string).lower();
- return CSSPrimitiveValue::create(variableName, CSSPrimitiveValue::CSS_VARIABLE_NAME);
+ return CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_VARIABLE_NAME);
}
static inline bool isComma(CSSParserValue* value)
@@ -1711,8 +1658,16 @@
addProperty(longhands[i], value, important);
}
+void CSSParser::setCurrentProperty(CSSPropertyID propId)
+{
+ m_id = propId;
+}
+
bool CSSParser::parseValue(CSSPropertyID propId, bool important)
{
+ if (m_useCounter)
+ m_useCounter->count(propId);
+
if (!m_valueList)
return false;
@@ -2730,9 +2685,6 @@
case CSSPropertyPage:
return parsePage(propId, important);
case CSSPropertyFontStretch:
- case CSSPropertyTextLineThrough:
- case CSSPropertyTextOverline:
- case CSSPropertyTextUnderline:
return false;
// CSS Text Layout Module Level 3: Vertical writing support
case CSSPropertyWebkitTextEmphasis:
@@ -2767,17 +2719,15 @@
return parseFontVariantLigatures(important);
break;
case CSSPropertyWebkitClipPath:
- if (id == CSSValueNone)
+ if (id == CSSValueNone) {
validPrimitive = true;
- else if (value->unit == CSSParserValue::Function)
+ } else if (value->unit == CSSParserValue::Function) {
return parseBasicShape(propId, important);
-#if ENABLE(SVG)
- else if (value->unit == CSSPrimitiveValue::CSS_URI) {
+ } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_URI);
addProperty(propId, parsedValue.release(), important);
return true;
}
-#endif
break;
case CSSPropertyWebkitShapeInside:
case CSSPropertyWebkitShapeOutside:
@@ -2794,8 +2744,6 @@
case CSSPropertyWebkitShapePadding:
validPrimitive = (RuntimeEnabledFeatures::cssExclusionsEnabled() && !id && validUnit(value, FLength | FNonNeg));
break;
- case CSSPropertyWebkitWrap:
- return RuntimeEnabledFeatures::cssExclusionsEnabled() && parseShorthand(propId, webkitWrapShorthand(), important);
case CSSPropertyBorderBottomStyle:
case CSSPropertyBorderCollapse:
case CSSPropertyBorderLeftStyle:
@@ -2833,6 +2781,7 @@
case CSSPropertyTextTransform:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
+ case CSSPropertyTouchAction:
case CSSPropertyVariable:
case CSSPropertyVisibility:
case CSSPropertyWebkitAppearance:
@@ -2912,10 +2861,8 @@
validPrimitive = false;
break;
#endif
-#if ENABLE(SVG)
default:
return parseSVGValue(propId, important);
-#endif
}
if (validPrimitive) {
@@ -3026,6 +2973,8 @@
RefPtr<CSSValue> val2;
CSSPropertyID propId1, propId2;
CSSParserValue* parserValue = m_valueList->current();
+ // parseFillProperty() may modify m_implicitShorthand, so we MUST reset it
+ // before EACH return below.
if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) {
parsedProperty[i] = found = true;
addFillValue(values[i], val1.release());
@@ -3053,8 +3002,10 @@
// if we didn't find at least one match, this is an
// invalid shorthand and we have to ignore it
- if (!found)
+ if (!found) {
+ m_implicitShorthand = false;
return false;
+ }
}
// Now add all of the properties we found.
@@ -3100,14 +3051,10 @@
addProperty(CSSPropertyWebkitMaskClip, clipValue.release(), important);
}
+ m_implicitShorthand = false;
return true;
}
-bool CSSParser::cssVariablesEnabled() const
-{
- return m_context.isCSSVariablesEnabled;
-}
-
void CSSParser::storeVariableDeclaration(const CSSParserString& name, PassOwnPtr<CSSParserValueList> value, bool important)
{
// When CSSGrammar.y encounters an invalid declaration it passes null for the CSSParserValueList, just bail.
@@ -3117,7 +3064,7 @@
static const unsigned prefixLength = sizeof("-webkit-var-") - 1;
ASSERT(name.length() > prefixLength);
- AtomicString variableName = name.lowerSubstring(prefixLength, name.length() - prefixLength);
+ AtomicString variableName = name.atomicSubstring(prefixLength, name.length() - prefixLength);
StringBuilder builder;
for (unsigned i = 0, size = value->size(); i < size; i++) {
@@ -4534,6 +4481,33 @@
return false;
}
+// The function parses [ <integer> || <string> ] in <grid-line> (which can be stand alone or with 'span').
+bool CSSParser::parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName)
+{
+ CSSParserValue* value = m_valueList->current();
+ if (validUnit(value, FInteger) && value->fValue) {
+ numericValue = createPrimitiveNumericValue(value);
+ value = m_valueList->next();
+ if (value && value->unit == CSSPrimitiveValue::CSS_STRING) {
+ gridLineName = createPrimitiveStringValue(m_valueList->current());
+ m_valueList->next();
+ }
+ return true;
+ }
+
+ if (value->unit == CSSPrimitiveValue::CSS_STRING) {
+ gridLineName = createPrimitiveStringValue(m_valueList->current());
+ value = m_valueList->next();
+ if (value && validUnit(value, FInteger) && value->fValue) {
+ numericValue = createPrimitiveNumericValue(value);
+ m_valueList->next();
+ }
+ return true;
+ }
+
+ return false;
+}
+
PassRefPtr<CSSValue> CSSParser::parseGridPosition()
{
CSSParserValue* value = m_valueList->current();
@@ -4543,38 +4517,42 @@
}
RefPtr<CSSPrimitiveValue> numericValue;
+ RefPtr<CSSPrimitiveValue> gridLineName;
bool hasSeenSpanKeyword = false;
- if (validUnit(value, FInteger) && value->fValue) {
- numericValue = createPrimitiveNumericValue(value);
- value = m_valueList->next();
+ if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) {
+ value = m_valueList->current();
if (value && value->id == CSSValueSpan) {
hasSeenSpanKeyword = true;
m_valueList->next();
}
} else if (value->id == CSSValueSpan) {
hasSeenSpanKeyword = true;
- value = m_valueList->next();
- if (value && (validUnit(value, FInteger) && value->fValue)) {
- numericValue = createPrimitiveNumericValue(value);
- m_valueList->next();
- }
+ if (m_valueList->next())
+ parseIntegerOrStringFromGridPosition(numericValue, gridLineName);
}
- if (!hasSeenSpanKeyword)
- return numericValue.release();
+ // Check that we have consumed all the value list. For shorthands, the parser will pass
+ // the whole value list (including the opposite position).
+ if (m_valueList->current() && !isForwardSlashOperator(m_valueList->current()))
+ return 0;
- if (!numericValue && hasSeenSpanKeyword)
- return cssValuePool().createIdentifierValue(CSSValueSpan);
+ // If we didn't parse anything, this is not a valid grid position.
+ if (!hasSeenSpanKeyword && !gridLineName && !numericValue)
+ return 0;
// Negative numbers are not allowed for span (but are for <integer>).
- if (numericValue && numericValue->getIntValue() < 0)
+ if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
return 0;
RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
- values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
+ if (hasSeenSpanKeyword)
+ values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
if (numericValue)
values->append(numericValue.release());
+ if (gridLineName)
+ values->append(gridLineName.release());
+ ASSERT(values->length());
return values.release();
}
@@ -6097,11 +6075,9 @@
// Other operators aren't legal or we aren't done with the current shadow
// value. Treat as invalid.
return 0;
-#if ENABLE(SVG)
// -webkit-svg-shadow does not support multiple values.
if (propId == CSSPropertyWebkitSvgShadow)
return 0;
-#endif
// The value is good. Commit it.
context.commitValue();
} else if (validUnit(val, FLength, CSSStrictMode)) {
@@ -6384,13 +6360,13 @@
else if (isGeneratedImageValue(val)) {
RefPtr<CSSValue> value;
if (parseGeneratedImage(m_valueList.get(), value))
- context.commitImage(value);
+ context.commitImage(value.release());
else
return false;
} else if (val->unit == CSSParserValue::Function && equalIgnoringCase(val->function->name, "-webkit-image-set(")) {
RefPtr<CSSValue> value = parseImageSet(m_valueList.get());
if (value)
- context.commitImage(value);
+ context.commitImage(value.release());
else
return false;
} else if (val->id == CSSValueNone)
@@ -6406,7 +6382,7 @@
if (!context.canAdvance() && context.allowRepeat()) {
RefPtr<CSSValue> repeat;
if (parseBorderImageRepeat(repeat))
- context.commitRepeat(repeat);
+ context.commitRepeat(repeat.release());
}
if (!context.canAdvance() && context.requireWidth()) {
@@ -8598,11 +8574,9 @@
// See if the specified primitive is one we understand.
if (value->unit == CSSPrimitiveValue::CSS_URI) {
-#if ENABLE(SVG)
RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
list->append(referenceFilterValue);
referenceFilterValue->append(WebKitCSSSVGDocumentValue::create(value->string));
-#endif
} else {
const CSSParserString name = value->function->name;
unsigned maximumArgumentCount = 1;
@@ -9393,10 +9367,10 @@
// Main CSS tokenizer functions.
template <>
-LChar* CSSParserString::characters<LChar>() const { return characters8(); }
+const LChar* CSSParserString::characters<LChar>() const { return characters8(); }
template <>
-UChar* CSSParserString::characters<UChar>() const { return characters16(); }
+const UChar* CSSParserString::characters<UChar>() const { return characters16(); }
template <>
inline LChar*& CSSParser::currentCharacter<LChar>()
@@ -10016,7 +9990,7 @@
m_token = MINFUNCTION;
else if (isASCIIAlphaCaselessEqual(name[10], 'x') && isEqualToCSSIdentifier(name + 1, "webkit-ma"))
m_token = MAXFUNCTION;
- else if (cssVariablesEnabled() && isASCIIAlphaCaselessEqual(name[10], 'r') && isEqualToCSSIdentifier(name + 1, "webkit-va"))
+ else if (RuntimeEnabledFeatures::cssVariablesEnabled() && isASCIIAlphaCaselessEqual(name[10], 'r') && isEqualToCSSIdentifier(name + 1, "webkit-va"))
m_token = VARFUNCTION;
} else if (length == 12 && isEqualToCSSIdentifier(name + 1, "webkit-calc"))
m_token = CALCFUNCTION;
@@ -10267,6 +10241,17 @@
}
}
+template <typename CharacterType>
+inline bool CSSParser::detectCSSVariablesToken(int length)
+{
+ ASSERT(tokenStart<CharacterType>()[0] == '-');
+ if (length < sizeof("-webkit-var-*") - 1)
+ return false;
+ CharacterType* name = tokenStart<CharacterType>();
+ return name[11] == '-' && isIdentifierStartAfterDash(name + 12) && isEqualToCSSIdentifier(name + 1, "webkit-var");
+}
+
+
template <typename SrcCharacterType>
int CSSParser::realLex(void* yylvalWithoutType)
{
@@ -10395,7 +10380,6 @@
break;
}
-#if ENABLE(SVG)
// Use SVG parser for numbers on SVG presentation attributes.
if (m_context.mode == SVGAttributeMode) {
// We need to take care of units like 'em' or 'ex'.
@@ -10414,9 +10398,9 @@
}
if (!parseSVGNumber(tokenStart<SrcCharacterType>(), character - tokenStart<SrcCharacterType>(), yylval->number))
break;
- } else
-#endif
+ } else {
yylval->number = charactersToDouble(tokenStart<SrcCharacterType>(), currentCharacter<SrcCharacterType>() - tokenStart<SrcCharacterType>());
+ }
// Type of the function.
if (isIdentifierStart<SrcCharacterType>()) {
@@ -10451,7 +10435,7 @@
parseIdentifier(result, resultString, hasEscape);
m_token = IDENT;
- if (cssVariablesEnabled() && isEqualToCSSIdentifier(tokenStart<SrcCharacterType>() + 1, "webkit-var") && tokenStart<SrcCharacterType>()[11] == '-' && isIdentifierStartAfterDash(tokenStart<SrcCharacterType>() + 12))
+ if (RuntimeEnabledFeatures::cssVariablesEnabled() && detectCSSVariablesToken<SrcCharacterType>(result - tokenStart<SrcCharacterType>()))
m_token = VAR_DEFINITION;
else if (*currentCharacter<SrcCharacterType>() == '(') {
m_token = FUNCTION;
@@ -10914,11 +10898,72 @@
return listPtr;
}
-void CSSParser::syntaxError(const CSSParserLocation& location, SyntaxErrorType error)
+
+template <typename CharacterType>
+ALWAYS_INLINE static void makeLower(const CharacterType* input, CharacterType* output, unsigned length)
{
- if (!isLoggingErrors())
+ // FIXME: If we need Unicode lowercasing here, then we probably want the real kind
+ // that can potentially change the length of the string rather than the character
+ // by character kind. If we don't need Unicode lowercasing, it would be good to
+ // simplify this function.
+
+ if (charactersAreAllASCII(input, length)) {
+ // Fast case for all-ASCII.
+ for (unsigned i = 0; i < length; i++)
+ output[i] = toASCIILower(input[i]);
+ } else {
+ for (unsigned i = 0; i < length; i++)
+ output[i] = Unicode::toLower(input[i]);
+ }
+}
+
+void CSSParser::tokenToLowerCase(const CSSParserString& token)
+{
+ size_t length = token.length();
+ if (is8BitSource()) {
+ size_t offset = token.characters8() - m_dataStart8.get();
+ makeLower(token.characters8(), m_dataStart8.get() + offset, length);
+ } else {
+ size_t offset = token.characters16() - m_dataStart16.get();
+ makeLower(token.characters16(), m_dataStart16.get() + offset, length);
+ }
+}
+
+void CSSParser::endInvalidRuleHeader()
+{
+ if (m_ruleHeaderType == CSSRuleSourceData::UNKNOWN_RULE)
return;
- if (!InspectorInstrumentation::cssErrorFilter(location, error))
+
+ CSSParserLocation location;
+ location.lineNumber = m_ruleHeaderStartLineNumber;
+ if (is8BitSource())
+ location.token.init(m_dataStart8.get() + m_ruleHeaderStartOffset, 0);
+ else
+ location.token.init(m_dataStart16.get() + m_ruleHeaderStartOffset, 0);
+
+ reportError(location, m_ruleHeaderType == CSSRuleSourceData::STYLE_RULE ? InvalidSelectorError : InvalidRuleError);
+
+ endRuleHeader();
+}
+
+void CSSParser::reportError(const CSSParserLocation& location, ErrorType error)
+{
+ if (!isLoggingErrors() || (m_ruleHeaderType == CSSRuleSourceData::SUPPORTS_RULE && error != InvalidSupportsConditionError))
+ return;
+
+ m_ignoreErrors = true;
+ CSSParserString content = location.token;
+ if (error == InvalidPropertyValueError || error == InvalidSelectorError) {
+ if (m_source) {
+ if (is8BitSource())
+ content.init(*m_source, location.token.characters8() - m_dataStart8.get(), tokenStart<LChar>() - location.token.characters8());
+ else
+ content.init(*m_source, location.token.characters16() - m_dataStart16.get(), tokenStart<UChar>() - location.token.characters16());
+ content.trimTrailingWhitespace();
+ }
+ }
+
+ if (!InspectorInstrumentation::cssErrorFilter(content, m_id, error))
return;
StringBuilder builder;
@@ -10927,23 +10972,41 @@
builder.appendLiteral("Invalid CSS property declaration at: ");
break;
+ case InvalidPropertyValueError:
+ builder.appendLiteral("Invalid CSS property value: ");
+ break;
+
+ case InvalidPropertyError:
+ builder.appendLiteral("Invalid CSS property name: ");
+ break;
+
+ case InvalidSelectorError:
+ builder.appendLiteral("Invalid CSS selector: ");
+ break;
+
+ case InvalidSupportsConditionError:
+ builder.appendLiteral("Invalid CSS @supports condition: ");
+ break;
+
+ case InvalidRuleError:
+ builder.appendLiteral("Invalid CSS rule: ");
+ break;
+
default:
builder.appendLiteral("Unexpected CSS token: ");
}
- if (location.token.is8Bit())
- builder.append(location.token.characters8(), location.token.length());
+ if (content.is8Bit())
+ builder.append(content.characters8(), content.length());
else
- builder.append(location.token.characters16(), location.token.length());
+ builder.append(content.characters16(), content.length());
logError(builder.toString(), location.lineNumber);
-
- m_ignoreErrorsInDeclaration = true;
}
bool CSSParser::isLoggingErrors()
{
- return m_logErrors && !m_ignoreErrorsInDeclaration;
+ return m_logErrors && !m_ignoreErrors;
}
void CSSParser::logError(const String& message, int lineNumber)
@@ -11073,25 +11136,25 @@
return specifiers;
}
- CSSParserSelector* lastShadowDescendant = specifiers;
+ CSSParserSelector* lastShadowPseudo = specifiers;
CSSParserSelector* history = specifiers;
while (history->tagHistory()) {
history = history->tagHistory();
- if (history->isCustomPseudoElement() || history->hasShadowDescendant())
- lastShadowDescendant = history;
+ if (history->isCustomPseudoElement() || history->hasShadowPseudo())
+ lastShadowPseudo = history;
}
- if (lastShadowDescendant->tagHistory()) {
+ if (lastShadowPseudo->tagHistory()) {
if (tag != anyQName())
- lastShadowDescendant->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule);
+ lastShadowPseudo->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule);
return specifiers;
}
- // For shadow-ID pseudo-elements to be correctly matched, the ShadowDescendant combinator has to be used.
+ // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo combinator has to be used.
// We therefore create a new Selector with that combinator here in any case, even if matching any (host) element in any namespace (i.e. '*').
OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelector(tag));
- lastShadowDescendant->setTagHistory(elementNameSelector.release());
- lastShadowDescendant->setRelation(CSSSelector::ShadowDescendant);
+ lastShadowPseudo->setTagHistory(elementNameSelector.release());
+ lastShadowPseudo->setRelation(CSSSelector::ShadowPseudo);
return specifiers;
}
@@ -11109,21 +11172,28 @@
CSSParserSelector* end = argumentSelector;
while (end->tagHistory())
end = end->tagHistory();
- end->setTagHistory(sinkFloatingSelector(specifiers));
- end->setRelation(CSSSelector::ShadowDistributed);
- return argumentSelector;
+
+ switch (end->relation()) {
+ case CSSSelector::Child:
+ case CSSSelector::Descendant:
+ end->setTagHistory(sinkFloatingSelector(specifiers));
+ end->setRelationIsForShadowDistributed();
+ return argumentSelector;
+ default:
+ return 0;
+ }
}
CSSParserSelector* CSSParser::rewriteSpecifiers(CSSParserSelector* specifiers, CSSParserSelector* newSpecifier)
{
if (newSpecifier->isCustomPseudoElement() || newSpecifier->pseudoType() == CSSSelector::PseudoCue) {
// Unknown pseudo element always goes at the top of selector chain.
- newSpecifier->appendTagHistory(CSSSelector::ShadowDescendant, sinkFloatingSelector(specifiers));
+ newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSelector(specifiers));
return newSpecifier;
}
if (specifiers->isCustomPseudoElement()) {
// Specifiers for unknown pseudo element go right behind it in the chain.
- specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier), CSSSelector::ShadowDescendant);
+ specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier), CSSSelector::ShadowPseudo);
return specifiers;
}
specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier));
@@ -11215,14 +11285,6 @@
// Create a key string from the passed keys
StringBuilder keyString;
for (unsigned i = 0; i < keys->size(); ++i) {
- // Just as per the comment below, we ignore keyframes with
- // invalid key values (plain numbers or unknown identifiers)
- // marked as CSSPrimitiveValue::CSS_UNKNOWN during parsing.
- if (keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_UNKNOWN) {
- clearProperties();
- return 0;
- }
-
ASSERT(keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_NUMBER);
float key = static_cast<float>(keys->valueAt(i)->fValue);
if (key < 0 || key > 100) {
@@ -11267,12 +11329,17 @@
void CSSParser::startRuleHeader(CSSRuleSourceData::Type ruleType)
{
+ resumeErrorLogging();
+ m_ruleHeaderType = ruleType;
+ m_ruleHeaderStartOffset = safeUserStringTokenOffset();
+ m_ruleHeaderStartLineNumber = m_tokenStartLineNumber;
if (m_sourceDataHandler)
- m_sourceDataHandler->startRuleHeader(ruleType, safeUserStringTokenOffset());
+ m_sourceDataHandler->startRuleHeader(ruleType, m_ruleHeaderStartOffset);
}
void CSSParser::endRuleHeader()
{
+ m_ruleHeaderType = CSSRuleSourceData::UNKNOWN_RULE;
if (m_sourceDataHandler)
m_sourceDataHandler->endRuleHeader(safeUserStringTokenOffset());
}
@@ -11303,13 +11370,14 @@
void CSSParser::startProperty()
{
- m_ignoreErrorsInDeclaration = false;
+ resumeErrorLogging();
if (m_sourceDataHandler)
m_sourceDataHandler->startProperty(safeUserStringTokenOffset());
}
-void CSSParser::endProperty(bool isImportantFound, bool isPropertyParsed, SyntaxErrorType errorType)
+void CSSParser::endProperty(bool isImportantFound, bool isPropertyParsed, ErrorType errorType)
{
+ m_id = CSSPropertyInvalid;
if (m_sourceDataHandler)
m_sourceDataHandler->endProperty(isImportantFound, isPropertyParsed, safeUserStringTokenOffset(), errorType);
}
diff --git a/Source/core/css/CSSParser.h b/Source/core/css/CSSParser.h
index 0fbe9fb..e7099ae 100644
--- a/Source/core/css/CSSParser.h
+++ b/Source/core/css/CSSParser.h
@@ -32,6 +32,8 @@
#include "core/css/CSSPropertySourceData.h"
#include "core/css/CSSSelector.h"
#include "core/css/MediaQuery.h"
+#include "core/css/WebKitCSSFilterValue.h"
+#include "core/page/UseCounter.h"
#include "core/platform/graphics/Color.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
@@ -39,8 +41,6 @@
#include <wtf/text/AtomicString.h>
#include <wtf/Vector.h>
-#include "core/css/WebKitCSSFilterValue.h"
-
namespace WebCore {
class AnimationParseContext;
@@ -52,10 +52,11 @@
class CSSBasicShape;
class Document;
class Element;
+class ImmutableStylePropertySet;
class MediaQueryExp;
class MediaQuerySet;
+class MutableStylePropertySet;
class StyleKeyframe;
-class StylePropertySet;
class StylePropertyShorthand;
class StyleRuleBase;
class StyleRuleKeyframes;
@@ -74,13 +75,18 @@
public:
class SourceDataHandler;
- enum SyntaxErrorType {
- NoSyntaxError,
+ enum ErrorType {
+ NoError,
PropertyDeclarationError,
- GeneralSyntaxError
+ InvalidPropertyValueError,
+ InvalidPropertyError,
+ InvalidSelectorError,
+ InvalidSupportsConditionError,
+ InvalidRuleError,
+ GeneralError
};
- CSSParser(const CSSParserContext&);
+ CSSParser(const CSSParserContext&, UseCounter* = 0);
~CSSParser();
@@ -88,13 +94,13 @@
PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
bool parseSupportsCondition(const String&);
- static bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*);
+ static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, CSSParserMode, StyleSheetContents*);
static bool parseColor(RGBA32& color, const String&, bool strict = false);
static bool parseSystemColor(RGBA32& color, const String&, Document*);
static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int ident, CSSParserValue*);
- bool parseDeclaration(StylePropertySet*, const String&, SourceDataHandler*, StyleSheetContents* contextStyleSheet);
- static PassRefPtr<StylePropertySet> parseInlineStyleDeclaration(const String&, Element*);
+ bool parseDeclaration(MutableStylePropertySet*, const String&, SourceDataHandler*, StyleSheetContents* contextStyleSheet);
+ static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(const String&, Element*);
PassOwnPtr<MediaQuery> parseMediaQuery(const String&);
void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
@@ -102,6 +108,7 @@
void rollbackLastProperties(int num);
bool hasProperties() const { return !m_parsedProperties.isEmpty(); }
void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtr<CSSValue>, bool);
+ void setCurrentProperty(CSSPropertyID);
bool parseValue(CSSPropertyID, bool important);
bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool important);
@@ -109,8 +116,7 @@
bool parseContent(CSSPropertyID, bool important);
bool parseQuotes(CSSPropertyID, bool important);
- static bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, Document*);
- bool cssVariablesEnabled() const;
+ static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, Document*);
void storeVariableDeclaration(const CSSParserString&, PassOwnPtr<CSSParserValueList>, bool important);
PassRefPtr<CSSValue> parseAttr(CSSParserValueList* args);
@@ -158,6 +164,7 @@
bool cssGridLayoutEnabled() const;
PassRefPtr<CSSValue> parseGridPosition();
+ bool parseIntegerOrStringFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName);
bool parseGridItemPositionShorthand(CSSPropertyID, bool important);
bool parseGridTrackList(CSSPropertyID, bool important);
PassRefPtr<CSSPrimitiveValue> parseGridTrackSize();
@@ -193,12 +200,10 @@
bool parseFontFaceSrc();
bool parseFontFaceUnicodeRange();
-#if ENABLE(SVG)
bool parseSVGValue(CSSPropertyID propId, bool important);
PassRefPtr<CSSValue> parseSVGPaint();
PassRefPtr<CSSValue> parseSVGColor();
PassRefPtr<CSSValue> parseSVGStrokeDasharray();
-#endif
// CSS3 Parsing Routines (for properties specific to CSS3)
PassRefPtr<CSSValueList> parseShadow(CSSParserValueList*, CSSPropertyID);
@@ -340,7 +345,7 @@
void clearProperties();
- PassRefPtr<StylePropertySet> createStylePropertySet();
+ PassRefPtr<ImmutableStylePropertySet> createStylePropertySet();
CSSParserContext m_context;
@@ -366,7 +371,7 @@
bool m_hasFontFaceOnlyValues;
bool m_hadSyntacticallyValidCSSRule;
bool m_logErrors;
- bool m_ignoreErrorsInDeclaration;
+ bool m_ignoreErrors;
bool m_inFilterRule;
@@ -384,14 +389,19 @@
void startRuleBody();
void endRuleBody(bool discard = false);
void startProperty();
- void endProperty(bool isImportantFound, bool isPropertyParsed, SyntaxErrorType = NoSyntaxError);
+ void endProperty(bool isImportantFound, bool isPropertyParsed, ErrorType = NoError);
void startEndUnknownRule();
- void syntaxError(const CSSParserLocation&, SyntaxErrorType = GeneralSyntaxError);
+
+ void endInvalidRuleHeader();
+ void reportError(const CSSParserLocation&, ErrorType = GeneralError);
+ void resumeErrorLogging() { m_ignoreErrors = false; }
inline int lex(void* yylval) { return (this->*m_lexFunc)(yylval); }
int token() { return m_token; }
+ void tokenToLowerCase(const CSSParserString& token);
+
#if ENABLE(CSS_DEVICE_ADAPTATION)
void markViewportRuleBodyStart() { m_inViewport = true; }
void markViewportRuleBodyEnd() { m_inViewport = false; }
@@ -407,7 +417,30 @@
CSSParserLocation currentLocation();
private:
- bool is8BitSource() { return m_is8BitSource; }
+ enum PropertyType {
+ PropertyExplicit,
+ PropertyImplicit
+ };
+
+ class ImplicitScope {
+ WTF_MAKE_NONCOPYABLE(ImplicitScope);
+ public:
+ ImplicitScope(WebCore::CSSParser* parser, PropertyType propertyType)
+ : m_parser(parser)
+ {
+ m_parser->m_implicitShorthand = propertyType == CSSParser::PropertyImplicit;
+ }
+
+ ~ImplicitScope()
+ {
+ m_parser->m_implicitShorthand = false;
+ }
+
+ private:
+ WebCore::CSSParser* m_parser;
+ };
+
+ bool is8BitSource() const { return m_is8BitSource; }
template <typename SourceCharacterType>
int realLex(void* yylval);
@@ -471,6 +504,8 @@
inline void detectAtToken(int, bool);
template <typename CharacterType>
inline void detectSupportsToken(int);
+ template <typename CharacterType>
+ inline bool detectCSSVariablesToken(int);
void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleSheet; }
@@ -496,8 +531,8 @@
bool isGeneratedImageValue(CSSParserValue*) const;
bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&);
- bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet);
- PassRefPtr<StylePropertySet> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet);
+ bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet);
+ PassRefPtr<ImmutableStylePropertySet> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet);
enum SizeParameterType {
None,
@@ -529,6 +564,7 @@
OwnArrayPtr<UChar> m_dataStart16;
LChar* m_currentCharacter8;
UChar* m_currentCharacter16;
+ const String* m_source;
union {
LChar* ptr8;
UChar* ptr16;
@@ -538,6 +574,9 @@
int m_lineNumber;
int m_tokenStartLineNumber;
int m_lastSelectorLineNumber;
+ CSSRuleSourceData::Type m_ruleHeaderType;
+ unsigned m_ruleHeaderStartOffset;
+ int m_ruleHeaderStartLineNumber;
bool m_allowImportRules;
bool m_allowNamespaceDeclarations;
@@ -617,6 +656,8 @@
inline unsigned safeUserStringTokenOffset();
+ UseCounter* m_useCounter;
+
friend class TransformOperationInfo;
friend class FilterOperationInfo;
};
@@ -658,7 +699,7 @@
virtual void endRuleBody(unsigned offset, bool error) = 0;
virtual void startEndUnknownRule() = 0;
virtual void startProperty(unsigned offset) = 0;
- virtual void endProperty(bool isImportant, bool isParsed, unsigned offset, CSSParser::SyntaxErrorType) = 0;
+ virtual void endProperty(bool isImportant, bool isParsed, unsigned offset, CSSParser::ErrorType) = 0;
virtual void startComment(unsigned offset) = 0;
virtual void endComment(unsigned offset) = 0;
};
diff --git a/Source/core/css/CSSParserMode.h b/Source/core/css/CSSParserMode.h
index ded9b38..4ca5f54 100644
--- a/Source/core/css/CSSParserMode.h
+++ b/Source/core/css/CSSParserMode.h
@@ -68,7 +68,7 @@
bool isCSSStickyPositionEnabled;
bool isCSSCompositingEnabled;
bool isCSSGridLayoutEnabled;
- bool isCSSVariablesEnabled;
+ bool isCSSTouchActionEnabled;
bool needsSiteSpecificQuirks;
};
diff --git a/Source/core/css/CSSParserValues.cpp b/Source/core/css/CSSParserValues.cpp
index adc1cbe..de470d5 100644
--- a/Source/core/css/CSSParserValues.cpp
+++ b/Source/core/css/CSSParserValues.cpp
@@ -25,7 +25,6 @@
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSSelector.h"
#include "core/css/CSSSelectorList.h"
-#include "core/css/CSSVariableValue.h"
namespace WebCore {
diff --git a/Source/core/css/CSSParserValues.h b/Source/core/css/CSSParserValues.h
index d3d12c2..46c0c3d 100644
--- a/Source/core/css/CSSParserValues.h
+++ b/Source/core/css/CSSParserValues.h
@@ -21,6 +21,7 @@
#ifndef CSSParserValues_h
#define CSSParserValues_h
+#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSSelector.h"
#include "core/css/CSSValueList.h"
#include <wtf/text/AtomicString.h>
@@ -32,14 +33,14 @@
class QualifiedName;
struct CSSParserString {
- void init(LChar* characters, unsigned length)
+ void init(const LChar* characters, unsigned length)
{
m_data.characters8 = characters;
m_length = length;
m_is8Bit = true;
}
- void init(UChar* characters, unsigned length)
+ void init(const UChar* characters, unsigned length)
{
m_data.characters16 = characters;
m_length = length;
@@ -48,12 +49,17 @@
void init(const String& string)
{
- m_length = string.length();
+ init(string, 0, string.length());
+ }
+
+ void init(const String& string, unsigned startOffset, unsigned length)
+ {
+ m_length = length;
if (m_length && string.is8Bit()) {
- m_data.characters8 = const_cast<LChar*>(string.characters8());
+ m_data.characters8 = const_cast<LChar*>(string.characters8()) + startOffset;
m_is8Bit = true;
} else {
- m_data.characters16 = const_cast<UChar*>(string.characters());
+ m_data.characters16 = const_cast<UChar*>(string.characters()) + startOffset;
m_is8Bit = false;
}
}
@@ -65,17 +71,17 @@
m_is8Bit = false;
}
+ void trimTrailingWhitespace();
+
bool is8Bit() const { return m_is8Bit; }
- LChar* characters8() const { ASSERT(is8Bit()); return m_data.characters8; }
- UChar* characters16() const { ASSERT(!is8Bit()); return m_data.characters16; }
+ const LChar* characters8() const { ASSERT(is8Bit()); return m_data.characters8; }
+ const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.characters16; }
template <typename CharacterType>
- CharacterType* characters() const;
+ const CharacterType* characters() const;
unsigned length() const { return m_length; }
void setLength(unsigned length) { m_length = length; }
- void lower();
-
UChar operator[](unsigned i) const
{
ASSERT_WITH_SECURITY_IMPLICATION(i < m_length);
@@ -91,14 +97,27 @@
return WTF::equalIgnoringCase(str, characters16(), length());
}
+ template <size_t strLength>
+ bool startsWithIgnoringCase(const char (&str)[strLength]) const
+ {
+ return startsWithIgnoringCase(str, strLength - 1);
+ }
+
+ bool startsWithIgnoringCase(const char* str, size_t strLength) const
+ {
+ if (length() < strLength)
+ return false;
+ return is8Bit() ? WTF::equalIgnoringCase(str, characters8(), strLength) : WTF::equalIgnoringCase(str, characters16(), strLength);
+ }
+
operator String() const { return is8Bit() ? String(m_data.characters8, m_length) : String(m_data.characters16, m_length); }
operator AtomicString() const { return is8Bit() ? AtomicString(m_data.characters8, m_length) : AtomicString(m_data.characters16, m_length); }
- AtomicString lowerSubstring(unsigned position, unsigned length) const;
+ AtomicString atomicSubstring(unsigned position, unsigned length) const;
union {
- LChar* characters8;
- UChar* characters16;
+ const LChar* characters8;
+ const UChar* characters16;
} m_data;
unsigned m_length;
bool m_is8Bit;
@@ -122,6 +141,7 @@
};
int unit;
+ inline void setFromNumber(double value, int unit = CSSPrimitiveValue::CSS_NUMBER);
PassRefPtr<CSSValue> createCSSValue();
};
@@ -169,7 +189,7 @@
};
class CSSParserSelector {
- WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(CSSParserSelector); WTF_MAKE_FAST_ALLOCATED;
public:
CSSParserSelector();
explicit CSSParserSelector(const QualifiedName&);
@@ -177,12 +197,14 @@
PassOwnPtr<CSSSelector> releaseSelector() { return m_selector.release(); }
+ CSSSelector::Relation relation() const { return m_selector->relation(); }
void setValue(const AtomicString& value) { m_selector->setValue(value); }
void setAttribute(const QualifiedName& value) { m_selector->setAttribute(value); }
void setArgument(const AtomicString& value) { m_selector->setArgument(value); }
void setMatch(CSSSelector::Match value) { m_selector->m_match = value; }
void setRelation(CSSSelector::Relation value) { m_selector->m_relation = value; }
void setForPage() { m_selector->setForPage(); }
+ void setRelationIsForShadowDistributed() { m_selector->setRelationIsForShadowDistributed(); }
void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
@@ -195,7 +217,7 @@
bool isCustomPseudoElement() const { return m_selector->isCustomPseudoElement(); }
bool isSimple() const;
- bool hasShadowDescendant() const;
+ bool hasShadowPseudo() const;
CSSParserSelector* tagHistory() const { return m_tagHistory.get(); }
void setTagHistory(PassOwnPtr<CSSParserSelector> selector) { m_tagHistory = selector; }
@@ -210,9 +232,17 @@
CSSParserSelector* m_functionArgumentSelector;
};
-inline bool CSSParserSelector::hasShadowDescendant() const
+inline bool CSSParserSelector::hasShadowPseudo() const
{
- return m_selector->relation() == CSSSelector::ShadowDescendant;
+ return m_selector->relation() == CSSSelector::ShadowPseudo;
+}
+
+inline void CSSParserValue::setFromNumber(double value, int unit)
+{
+ id = 0;
+ isInt = false;
+ fValue = value;
+ this->unit = unit;
}
}
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index c468b79..13db75e 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -35,10 +35,8 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/Node.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/platform/CalculationValue.h"
#include "core/platform/LayoutUnit.h"
#include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/Font.h"
#include "core/rendering/style/RenderStyle.h"
#include <wtf/ASCIICType.h>
#include <wtf/DecimalNumber.h>
diff --git a/Source/core/css/CSSPrimitiveValue.idl b/Source/core/css/CSSPrimitiveValue.idl
index 8581cdb..ff49620 100644
--- a/Source/core/css/CSSPrimitiveValue.idl
+++ b/Source/core/css/CSSPrimitiveValue.idl
@@ -18,7 +18,6 @@
*/
[
- ImplementationLacksVTable
] interface CSSPrimitiveValue : CSSValue {
// UnitTypes
diff --git a/Source/core/css/CSSPrimitiveValueMappings.h b/Source/core/css/CSSPrimitiveValueMappings.h
index 10f5c4e..2b335bb 100644
--- a/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/Source/core/css/CSSPrimitiveValueMappings.h
@@ -2285,23 +2285,23 @@
}
#endif // CSS3_TEXT
-template<> inline CSSPrimitiveValue::operator ETextDecoration() const
+template<> inline CSSPrimitiveValue::operator TextDecoration() const
{
switch (m_value.ident) {
case CSSValueNone:
- return TDNONE;
+ return TextDecorationNone;
case CSSValueUnderline:
- return UNDERLINE;
+ return TextDecorationUnderline;
case CSSValueOverline:
- return OVERLINE;
+ return TextDecorationOverline;
case CSSValueLineThrough:
- return LINE_THROUGH;
+ return TextDecorationLineThrough;
case CSSValueBlink:
- return BLINK;
+ return TextDecorationBlink;
}
ASSERT_NOT_REACHED();
- return TDNONE;
+ return TextDecorationNone;
}
#if ENABLE(CSS3_TEXT)
@@ -3670,8 +3670,6 @@
return BlendModeNormal;
}
-#if ENABLE(SVG)
-
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
: CSSValue(PrimitiveClass)
{
@@ -3841,8 +3839,6 @@
return AB_AUTO;
}
-#endif
-
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e)
: CSSValue(PrimitiveClass)
{
@@ -4160,8 +4156,6 @@
return Length(Undefined);
}
-#if ENABLE(SVG)
-
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e)
: CSSValue(PrimitiveClass)
{
@@ -4505,7 +4499,32 @@
return MT_LUMINANCE;
}
-#endif // ENABLE(SVG)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction t)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = CSS_IDENT;
+ switch (t) {
+ case TouchActionNone:
+ m_value.ident = CSSValueNone;
+ break;
+ case TouchActionAuto:
+ m_value.ident = CSSValueAuto;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator TouchAction() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return TouchActionNone;
+ case CSSValueAuto:
+ return TouchActionAuto;
+ }
+
+ ASSERT_NOT_REACHED();
+ return TouchActionNone;
+}
}
diff --git a/Source/core/css/CSSProperties.in b/Source/core/css/CSSProperties.in
new file mode 100644
index 0000000..e945fb0
--- /dev/null
+++ b/Source/core/css/CSSProperties.in
@@ -0,0 +1,124 @@
+// FIXME: When we have all the properties using the new StyleBuilder, we
+// should use this for make_css_property_names.py
+// Note: Mandatory blank line to skip parameter parsing phase
+
+border-bottom-style type_name=EBorderStyle, initial=initialBorderStyle
+border-collapse
+border-left-style type_name=EBorderStyle, initial=initialBorderStyle
+border-right-style type_name=EBorderStyle, initial=initialBorderStyle
+border-top-style type_name=EBorderStyle, initial=initialBorderStyle
+bottom apply_type=length, initial=initialOffset, use_auto
+box-sizing
+caption-side
+clear
+empty-cells type_name=EEmptyCell
+float type_name=EFloat, name_for_methods=Floating
+height apply_type=length, initial=initialSize, use_auto, use_intrinsic
+image-rendering
+left apply_type=length, initial=initialOffset, use_auto
+list-style-position
+list-style-type
+margin-bottom apply_type=length, initial=initialMargin, use_auto
+margin-left apply_type=length, initial=initialMargin, use_auto
+margin-right apply_type=length, initial=initialMargin, use_auto
+margin-top apply_type=length, initial=initialMargin, use_auto
+max-height apply_type=length, initial=initialMaxSize, use_auto, use_intrinsic, use_none
+max-width apply_type=length, initial=initialMaxSize, use_auto, use_intrinsic, use_none
+min-height apply_type=length, initial=initialMinSize, use_auto, use_intrinsic, use_none
+min-width apply_type=length, initial=initialMinSize, use_auto, use_intrinsic
+mix-blend-mode type_name=BlendMode, name_for_methods=BlendMode
+opacity type_name=float
+overflow-wrap
+overflow-x type_name=EOverflow
+overflow-y type_name=EOverflow
+padding-bottom apply_type=length, initial=initialPadding
+padding-left apply_type=length, initial=initialPadding
+padding-right apply_type=length, initial=initialPadding
+padding-top apply_type=length, initial=initialPadding
+page-break-after type_name=EPageBreak, initial=initialPageBreak
+page-break-before type_name=EPageBreak, initial=initialPageBreak
+page-break-inside type_name=EPageBreak, initial=initialPageBreak
+pointer-events
+position
+right apply_type=length, initial=initialOffset, use_auto
+speak
+table-layout
+tab-size type_name=unsigned
+text-overflow type_name=TextOverflow
+text-transform
+top apply_type=length, initial=initialOffset, use_auto
+touch-action type_name=TouchAction, initial=initialTouchAction
+unicode-bidi
+visibility
+white-space
+width apply_type=length, initial=initialSize, use_auto, use_intrinsic
+word-break
+// UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
+word-wrap name_for_methods=OverflowWrap
+
+-webkit-align-content
+-webkit-align-items
+-webkit-align-self type_name=EAlignItems
+-webkit-appearance type_name=ControlPart
+-webkit-backface-visibility
+-webkit-border-fit
+-webkit-box-align type_name=EBoxAlignment
+-webkit-box-decoration-break
+-webkit-box-direction
+-webkit-box-flex-group type_name=unsigned int
+-webkit-box-flex type_name=float
+-webkit-box-lines
+-webkit-box-ordinal-group type_name=unsigned int
+-webkit-box-orient
+-webkit-box-pack
+-webkit-color-correction type_name=ColorSpace, name_for_methods=ColorSpace
+-webkit-column-axis type_name=ColumnAxis
+-webkit-column-break-after type_name=EPageBreak, initial=initialPageBreak
+-webkit-column-break-before type_name=EPageBreak, initial=initialPageBreak
+-webkit-column-break-inside type_name=EPageBreak, initial=initialPageBreak
+-webkit-column-progression type_name=ColumnProgression
+-webkit-column-rule-style type_name=EBorderStyle, initial=initialBorderStyle
+-webkit-column-span type_name=ColumnSpan
+-webkit-flex-basis apply_type=length, use_auto
+-webkit-flex-direction
+-webkit-flex-grow type_name=float
+-webkit-flex-shrink type_name=float
+-webkit-flex-wrap
+-webkit-grid-auto-flow type_name=GridAutoFlow
+-webkit-hyphens type_name=Hyphens
+-webkit-justify-content
+-webkit-line-align type_name=LineAlign
+-webkit-line-break type_name=LineBreak
+-webkit-line-clamp type_name=LineClampValue
+-webkit-line-snap type_name=LineSnap
+-webkit-margin-after-collapse type_name=EMarginCollapse
+-webkit-margin-before-collapse type_name=EMarginCollapse
+-webkit-margin-bottom-collapse type_name=EMarginCollapse, name_for_methods=MarginAfterCollapse
+-webkit-margin-top-collapse type_name=EMarginCollapse, name_for_methods=MarginBeforeCollapse
+-webkit-marquee-direction
+-webkit-marquee-style name_for_methods=MarqueeBehavior
+-webkit-order type_name=int
+-webkit-perspective-origin-x apply_type=length
+-webkit-perspective-origin-y apply_type=length
+-webkit-print-color-adjust type_name=PrintColorAdjust
+-webkit-region-break-after type_name=EPageBreak, initial=initialPageBreak
+-webkit-region-break-before type_name=EPageBreak, initial=initialPageBreak
+-webkit-region-break-inside type_name=EPageBreak, initial=initialPageBreak
+-webkit-region-overflow type_name=RegionOverflow
+-webkit-rtl-ordering type_name=Order, getter=rtlOrdering, setter=setRTLOrdering, initial=initialRTLOrdering
+-webkit-ruby-position type_name=RubyPosition
+-webkit-shape-margin apply_type=length
+-webkit-shape-padding apply_type=length
+-webkit-text-align-last type_name=TextAlignLast, condition=CSS3_TEXT
+-webkit-text-combine type_name=TextCombine
+-webkit-text-decoration-style type_name=TextDecorationStyle, condition=CSS3_TEXT
+-webkit-text-emphasis-position type_name=TextEmphasisPosition
+-webkit-text-security
+-webkit-transform-origin-x apply_type=length
+-webkit-transform-origin-y apply_type=length
+-webkit-transform-style name_for_methods=TransformStyle3D
+-webkit-user-drag
+-webkit-user-modify
+-webkit-user-select
+-webkit-wrap-flow type_name=WrapFlow
+-webkit-wrap-through type_name=WrapThrough
diff --git a/Source/core/css/CSSProperty.cpp b/Source/core/css/CSSProperty.cpp
index 93282bd..782b7f4 100644
--- a/Source/core/css/CSSProperty.cpp
+++ b/Source/core/css/CSSProperty.cpp
@@ -22,7 +22,6 @@
#include "core/css/CSSProperty.h"
#include "core/css/CSSValueList.h"
-#include "core/css/CSSVariableValue.h"
#include "core/css/StylePropertyShorthand.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/rendering/style/RenderStyleConstants.h"
@@ -255,30 +254,54 @@
case CSSPropertyBorderCollapse:
case CSSPropertyBorderSpacing:
case CSSPropertyCaptionSide:
+ case CSSPropertyClipRule:
case CSSPropertyColor:
+ case CSSPropertyColorInterpolation:
+ case CSSPropertyColorInterpolationFilters:
+ case CSSPropertyColorRendering:
case CSSPropertyCursor:
case CSSPropertyDirection:
case CSSPropertyEmptyCells:
+ case CSSPropertyFill:
+ case CSSPropertyFillOpacity:
+ case CSSPropertyFillRule:
case CSSPropertyFont:
case CSSPropertyFontFamily:
case CSSPropertyFontSize:
case CSSPropertyFontStyle:
case CSSPropertyFontVariant:
case CSSPropertyFontWeight:
+ case CSSPropertyGlyphOrientationHorizontal:
+ case CSSPropertyGlyphOrientationVertical:
case CSSPropertyImageRendering:
+ case CSSPropertyKerning:
case CSSPropertyLetterSpacing:
case CSSPropertyLineHeight:
case CSSPropertyListStyle:
case CSSPropertyListStyleImage:
- case CSSPropertyListStyleType:
case CSSPropertyListStylePosition:
+ case CSSPropertyListStyleType:
+ case CSSPropertyMarker:
+ case CSSPropertyMarkerEnd:
+ case CSSPropertyMarkerMid:
+ case CSSPropertyMarkerStart:
case CSSPropertyOrphans:
case CSSPropertyPointerEvents:
case CSSPropertyQuotes:
case CSSPropertyResize:
+ case CSSPropertyShapeRendering:
case CSSPropertySpeak:
+ case CSSPropertyStroke:
+ case CSSPropertyStrokeDasharray:
+ case CSSPropertyStrokeDashoffset:
+ case CSSPropertyStrokeLinecap:
+ case CSSPropertyStrokeLinejoin:
+ case CSSPropertyStrokeMiterlimit:
+ case CSSPropertyStrokeOpacity:
+ case CSSPropertyStrokeWidth:
case CSSPropertyTabSize:
case CSSPropertyTextAlign:
+ case CSSPropertyTextAnchor:
case CSSPropertyTextDecoration:
case CSSPropertyTextIndent:
case CSSPropertyTextRendering:
@@ -313,6 +336,7 @@
case CSSPropertyWebkitPrintColorAdjust:
case CSSPropertyWebkitRtlOrdering:
case CSSPropertyWebkitRubyPosition:
+ case CSSPropertyWebkitTapHighlightColor:
case CSSPropertyWebkitTextCombine:
#if ENABLE(CSS3_TEXT)
case CSSPropertyWebkitTextDecorationLine:
@@ -338,37 +362,9 @@
case CSSPropertyWordBreak:
case CSSPropertyWordSpacing:
case CSSPropertyWordWrap:
-#if ENABLE(SVG)
- case CSSPropertyClipRule:
- case CSSPropertyColorInterpolation:
- case CSSPropertyColorInterpolationFilters:
- case CSSPropertyColorRendering:
- case CSSPropertyFill:
- case CSSPropertyFillOpacity:
- case CSSPropertyFillRule:
- case CSSPropertyGlyphOrientationHorizontal:
- case CSSPropertyGlyphOrientationVertical:
- case CSSPropertyKerning:
- case CSSPropertyMarker:
- case CSSPropertyMarkerEnd:
- case CSSPropertyMarkerMid:
- case CSSPropertyMarkerStart:
- case CSSPropertyStroke:
- case CSSPropertyStrokeDasharray:
- case CSSPropertyStrokeDashoffset:
- case CSSPropertyStrokeLinecap:
- case CSSPropertyStrokeLinejoin:
- case CSSPropertyStrokeMiterlimit:
- case CSSPropertyStrokeOpacity:
- case CSSPropertyStrokeWidth:
- case CSSPropertyShapeRendering:
- case CSSPropertyTextAnchor:
case CSSPropertyWritingMode:
-#endif
- case CSSPropertyWebkitTapHighlightColor:
return true;
- case CSSPropertyDisplay:
- case CSSPropertyZoom:
+ case CSSPropertyAlignmentBaseline:
case CSSPropertyBackground:
case CSSPropertyBackgroundAttachment:
case CSSPropertyBackgroundBlendMode:
@@ -383,6 +379,7 @@
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
case CSSPropertyBackgroundSize:
+ case CSSPropertyBaselineShift:
case CSSPropertyBorder:
case CSSPropertyBorderBottom:
case CSSPropertyBorderBottomColor:
@@ -417,20 +414,32 @@
case CSSPropertyBottom:
case CSSPropertyBoxShadow:
case CSSPropertyBoxSizing:
+ case CSSPropertyBufferedRendering:
case CSSPropertyClear:
case CSSPropertyClip:
+ case CSSPropertyClipPath:
+ case CSSPropertyColorProfile:
case CSSPropertyContent:
case CSSPropertyCounterIncrement:
case CSSPropertyCounterReset:
+ case CSSPropertyDisplay:
+ case CSSPropertyDominantBaseline:
+ case CSSPropertyEnableBackground:
+ case CSSPropertyFilter:
case CSSPropertyFloat:
+ case CSSPropertyFloodColor:
+ case CSSPropertyFloodOpacity:
case CSSPropertyFontStretch:
case CSSPropertyHeight:
case CSSPropertyLeft:
+ case CSSPropertyLightingColor:
case CSSPropertyMargin:
case CSSPropertyMarginBottom:
case CSSPropertyMarginLeft:
case CSSPropertyMarginRight:
case CSSPropertyMarginTop:
+ case CSSPropertyMask:
+ case CSSPropertyMaskType:
case CSSPropertyMaxHeight:
case CSSPropertyMaxWidth:
case CSSPropertyMinHeight:
@@ -459,24 +468,24 @@
case CSSPropertyRight:
case CSSPropertySize:
case CSSPropertySrc:
+ case CSSPropertyStopColor:
+ case CSSPropertyStopOpacity:
case CSSPropertyTableLayout:
- case CSSPropertyTextLineThrough:
case CSSPropertyTextLineThroughColor:
case CSSPropertyTextLineThroughMode:
case CSSPropertyTextLineThroughStyle:
case CSSPropertyTextLineThroughWidth:
case CSSPropertyTextOverflow:
- case CSSPropertyTextOverline:
case CSSPropertyTextOverlineColor:
case CSSPropertyTextOverlineMode:
case CSSPropertyTextOverlineStyle:
case CSSPropertyTextOverlineWidth:
- case CSSPropertyTextUnderline:
case CSSPropertyTextUnderlineColor:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
case CSSPropertyTextUnderlineWidth:
case CSSPropertyTop:
+ case CSSPropertyTouchAction:
case CSSPropertyTransition:
case CSSPropertyTransitionDelay:
case CSSPropertyTransitionDuration:
@@ -484,9 +493,11 @@
case CSSPropertyTransitionTimingFunction:
case CSSPropertyUnicodeBidi:
case CSSPropertyUnicodeRange:
+ case CSSPropertyVectorEffect:
case CSSPropertyVerticalAlign:
- case CSSPropertyWidth:
- case CSSPropertyZIndex:
+ case CSSPropertyWebkitAlignContent:
+ case CSSPropertyWebkitAlignItems:
+ case CSSPropertyWebkitAlignSelf:
case CSSPropertyWebkitAnimation:
case CSSPropertyWebkitAnimationDelay:
case CSSPropertyWebkitAnimationDirection:
@@ -547,9 +558,6 @@
case CSSPropertyWebkitColumnWidth:
case CSSPropertyWebkitColumns:
case CSSPropertyWebkitFilter:
- case CSSPropertyWebkitAlignContent:
- case CSSPropertyWebkitAlignItems:
- case CSSPropertyWebkitAlignSelf:
case CSSPropertyWebkitFlex:
case CSSPropertyWebkitFlexBasis:
case CSSPropertyWebkitFlexDirection:
@@ -557,37 +565,37 @@
case CSSPropertyWebkitFlexGrow:
case CSSPropertyWebkitFlexShrink:
case CSSPropertyWebkitFlexWrap:
- case CSSPropertyWebkitJustifyContent:
- case CSSPropertyWebkitOrder:
case CSSPropertyWebkitFontSizeDelta:
+ case CSSPropertyWebkitGridAfter:
case CSSPropertyWebkitGridAutoColumns:
case CSSPropertyWebkitGridAutoFlow:
case CSSPropertyWebkitGridAutoRows:
+ case CSSPropertyWebkitGridBefore:
+ case CSSPropertyWebkitGridColumn:
case CSSPropertyWebkitGridColumns:
+ case CSSPropertyWebkitGridEnd:
+ case CSSPropertyWebkitGridRow:
case CSSPropertyWebkitGridRows:
case CSSPropertyWebkitGridStart:
- case CSSPropertyWebkitGridEnd:
- case CSSPropertyWebkitGridBefore:
- case CSSPropertyWebkitGridAfter:
- case CSSPropertyWebkitGridColumn:
- case CSSPropertyWebkitGridRow:
+ case CSSPropertyWebkitJustifyContent:
case CSSPropertyWebkitLineClamp:
- case CSSPropertyWebkitLogicalWidth:
case CSSPropertyWebkitLogicalHeight:
+ case CSSPropertyWebkitLogicalWidth:
+ case CSSPropertyWebkitMarginAfter:
case CSSPropertyWebkitMarginAfterCollapse:
+ case CSSPropertyWebkitMarginBefore:
case CSSPropertyWebkitMarginBeforeCollapse:
case CSSPropertyWebkitMarginBottomCollapse:
- case CSSPropertyWebkitMarginTopCollapse:
case CSSPropertyWebkitMarginCollapse:
- case CSSPropertyWebkitMarginAfter:
- case CSSPropertyWebkitMarginBefore:
case CSSPropertyWebkitMarginEnd:
case CSSPropertyWebkitMarginStart:
+ case CSSPropertyWebkitMarginTopCollapse:
case CSSPropertyWebkitMarquee:
case CSSPropertyWebkitMarqueeDirection:
case CSSPropertyWebkitMarqueeIncrement:
case CSSPropertyWebkitMarqueeRepetition:
case CSSPropertyWebkitMarqueeSpeed:
+ case CSSPropertyWebkitOrder:
case CSSPropertyWebkitMarqueeStyle:
case CSSPropertyWebkitMask:
case CSSPropertyWebkitMaskBoxImage:
@@ -641,39 +649,23 @@
case CSSPropertyWebkitRegionBreakAfter:
case CSSPropertyWebkitRegionBreakBefore:
case CSSPropertyWebkitRegionBreakInside:
- case CSSPropertyWebkitWrap:
case CSSPropertyWebkitWrapFlow:
case CSSPropertyWebkitShapeMargin:
case CSSPropertyWebkitShapePadding:
case CSSPropertyWebkitShapeInside:
case CSSPropertyWebkitShapeOutside:
- case CSSPropertyWebkitWrapThrough:
-#if ENABLE(SVG)
- case CSSPropertyClipPath:
- case CSSPropertyMask:
- case CSSPropertyMaskType:
- case CSSPropertyEnableBackground:
- case CSSPropertyFilter:
- case CSSPropertyFloodColor:
- case CSSPropertyFloodOpacity:
- case CSSPropertyLightingColor:
- case CSSPropertyStopColor:
- case CSSPropertyStopOpacity:
- case CSSPropertyColorProfile:
- case CSSPropertyAlignmentBaseline:
- case CSSPropertyBaselineShift:
- case CSSPropertyDominantBaseline:
- case CSSPropertyVectorEffect:
- case CSSPropertyBufferedRendering:
case CSSPropertyWebkitSvgShadow:
-#endif
+ case CSSPropertyWebkitWrapThrough:
case CSSPropertyWebkitAppRegion:
+ case CSSPropertyWidth:
#if ENABLE(CSS_DEVICE_ADAPTATION)
case CSSPropertyMaxZoom:
case CSSPropertyMinZoom:
case CSSPropertyOrientation:
case CSSPropertyUserZoom:
#endif
+ case CSSPropertyZIndex:
+ case CSSPropertyZoom:
return false;
case CSSPropertyInvalid:
ASSERT_NOT_REACHED();
diff --git a/Source/core/css/CSSPropertyNames.in b/Source/core/css/CSSPropertyNames.in
index 5753a42..2a18d74 100644
--- a/Source/core/css/CSSPropertyNames.in
+++ b/Source/core/css/CSSPropertyNames.in
@@ -157,13 +157,11 @@
text-align
text-decoration
text-indent
-text-line-through
text-line-through-color
text-line-through-mode
text-line-through-style
text-line-through-width
text-overflow
-text-overline
text-overline-color
text-overline-mode
text-overline-style
@@ -171,12 +169,12 @@
text-shadow
text-transform
-epub-text-transform alias_for=text-transform
-text-underline
text-underline-color
text-underline-mode
text-underline-style
text-underline-width
top
+touch-action
transition
transition-delay
transition-duration
@@ -398,7 +396,6 @@
-webkit-shape-padding
-webkit-wrap-flow
-webkit-wrap-through
--webkit-wrap
max-zoom condition=CSS_DEVICE_ADAPTATION
min-zoom condition=CSS_DEVICE_ADAPTATION
orientation condition=CSS_DEVICE_ADAPTATION
diff --git a/Source/core/css/CSSRule.idl b/Source/core/css/CSSRule.idl
index 593305c..983a464 100644
--- a/Source/core/css/CSSRule.idl
+++ b/Source/core/css/CSSRule.idl
@@ -22,8 +22,7 @@
[
CustomToV8,
- DependentLifetime,
- SkipVTableValidation
+ DependentLifetime
] interface CSSRule {
// RuleType
diff --git a/Source/core/css/CSSRuleList.cpp b/Source/core/css/CSSRuleList.cpp
index be1677a..8b7fcea 100644
--- a/Source/core/css/CSSRuleList.cpp
+++ b/Source/core/css/CSSRuleList.cpp
@@ -23,7 +23,6 @@
#include "core/css/CSSRuleList.h"
#include "core/css/CSSRule.h"
-#include "core/css/CSSStyleSheet.h"
#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
diff --git a/Source/core/css/CSSRuleList.idl b/Source/core/css/CSSRuleList.idl
index 0cbc656..e89a820 100644
--- a/Source/core/css/CSSRuleList.idl
+++ b/Source/core/css/CSSRuleList.idl
@@ -25,8 +25,7 @@
// Introduced in DOM Level 2:
[
- DependentLifetime,
- SkipVTableValidation
+ DependentLifetime
] interface CSSRuleList {
readonly attribute unsigned long length;
getter CSSRule item([Default=Undefined] optional unsigned long index);
diff --git a/Source/core/css/CSSSegmentedFontFace.cpp b/Source/core/css/CSSSegmentedFontFace.cpp
index 420368a..a5ebc16 100644
--- a/Source/core/css/CSSSegmentedFontFace.cpp
+++ b/Source/core/css/CSSSegmentedFontFace.cpp
@@ -27,9 +27,6 @@
#include "core/css/CSSSegmentedFontFace.h"
#include "core/css/CSSFontFace.h"
-#include "core/css/CSSFontFaceSource.h"
-#include "core/css/CSSFontSelector.h"
-#include "core/dom/Document.h"
#include "RuntimeEnabledFeatures.h"
#include "core/platform/graphics/FontDescription.h"
#include "core/platform/graphics/SegmentedFontData.h"
diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
index 418cc1d..74adeb1 100644
--- a/Source/core/css/CSSSelector.cpp
+++ b/Source/core/css/CSSSelector.cpp
@@ -684,8 +684,12 @@
if (const CSSSelector* tagHistory = cs->tagHistory()) {
switch (cs->relation()) {
case CSSSelector::Descendant:
+ if (cs->relationIsForShadowDistributed())
+ return tagHistory->selectorText("::-webkit-distributed(" + str.toString() + rightSide + ")");
return tagHistory->selectorText(" " + str.toString() + rightSide);
case CSSSelector::Child:
+ if (cs->relationIsForShadowDistributed())
+ return tagHistory->selectorText("::-webkit-distributed(> " + str.toString() + rightSide + ")");
return tagHistory->selectorText(" > " + str.toString() + rightSide);
case CSSSelector::DirectAdjacent:
return tagHistory->selectorText(" + " + str.toString() + rightSide);
@@ -693,10 +697,8 @@
return tagHistory->selectorText(" ~ " + str.toString() + rightSide);
case CSSSelector::SubSelector:
ASSERT_NOT_REACHED();
- case CSSSelector::ShadowDescendant:
+ case CSSSelector::ShadowPseudo:
return tagHistory->selectorText(str.toString() + rightSide);
- case CSSSelector::ShadowDistributed:
- return tagHistory->selectorText("::-webkit-distributed(" + str.toString() + rightSide + ")");
}
}
return str.toString() + rightSide;
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 526c737..e8fc3ae 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -79,8 +79,7 @@
DirectAdjacent,
IndirectAdjacent,
SubSelector,
- ShadowDescendant,
- ShadowDistributed
+ ShadowPseudo
};
enum PseudoType {
@@ -220,7 +219,6 @@
bool isSiblingSelector() const;
bool isAttributeSelector() const;
bool isDistributedPseudoElement() const;
- bool isShadowDistributed() const;
Relation relation() const { return static_cast<Relation>(m_relation); }
@@ -234,6 +232,9 @@
bool isForPage() const { return m_isForPage; }
void setForPage() { m_isForPage = true; }
+ bool relationIsForShadowDistributed() const { return m_relationIsForShadowDistributed; }
+ void setRelationIsForShadowDistributed() { m_relationIsForShadowDistributed = true; }
+
unsigned m_relation : 3; // enum Relation
mutable unsigned m_match : 4; // enum Match
mutable unsigned m_pseudoType : 8; // PseudoType
@@ -245,6 +246,7 @@
unsigned m_hasRareData : 1;
unsigned m_isForPage : 1;
unsigned m_tagIsForNamespaceRule : 1;
+ unsigned m_relationIsForShadowDistributed : 1;
unsigned specificityForOneSelector() const;
unsigned specificityForPage() const;
@@ -338,11 +340,6 @@
return m_match == PseudoElement && pseudoType() == PseudoDistributed;
}
-inline bool CSSSelector::isShadowDistributed() const
-{
- return m_relation == CSSSelector::ShadowDistributed;
-}
-
inline void CSSSelector::setValue(const AtomicString& value)
{
ASSERT(m_match != Tag);
@@ -371,6 +368,7 @@
, m_hasRareData(false)
, m_isForPage(false)
, m_tagIsForNamespaceRule(false)
+ , m_relationIsForShadowDistributed(false)
{
}
@@ -384,6 +382,7 @@
, m_hasRareData(false)
, m_isForPage(false)
, m_tagIsForNamespaceRule(tagIsForNamespaceRule)
+ , m_relationIsForShadowDistributed(false)
{
m_data.m_tagQName = tagQName.impl();
m_data.m_tagQName->ref();
@@ -399,6 +398,7 @@
, m_hasRareData(o.m_hasRareData)
, m_isForPage(o.m_isForPage)
, m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule)
+ , m_relationIsForShadowDistributed(o.m_relationIsForShadowDistributed)
{
if (o.m_match == Tag) {
m_data.m_tagQName = o.m_data.m_tagQName;
diff --git a/Source/core/css/CSSSelectorList.cpp b/Source/core/css/CSSSelectorList.cpp
index 75a4bba..c9c496f 100644
--- a/Source/core/css/CSSSelectorList.cpp
+++ b/Source/core/css/CSSSelectorList.cpp
@@ -190,7 +190,7 @@
public:
bool operator()(const CSSSelector* selector)
{
- return selector->isShadowDistributed();
+ return selector->relationIsForShadowDistributed();
}
};
diff --git a/Source/core/css/CSSSelectorList.h b/Source/core/css/CSSSelectorList.h
index da49222..7612248 100644
--- a/Source/core/css/CSSSelectorList.h
+++ b/Source/core/css/CSSSelectorList.h
@@ -71,6 +71,9 @@
unsigned length() const;
void deleteSelectors();
+ // Hide.
+ CSSSelectorList& operator=(const CSSSelectorList&);
+
// End of a multipart selector is indicated by m_isLastInTagHistory bit in the last item.
// End of the array is indicated by m_isLastInSelectorList bit in the last item.
CSSSelector* m_selectorArray;
diff --git a/Source/core/css/CSSStyleDeclaration.cpp b/Source/core/css/CSSStyleDeclaration.cpp
new file mode 100644
index 0000000..de30643
--- /dev/null
+++ b/Source/core/css/CSSStyleDeclaration.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "core/css/CSSStyleDeclaration.h"
+
+#include "core/css/CSSParser.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSStyleSheet.h"
+#include "core/css/CSSValue.h"
+#include "core/dom/Document.h"
+#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/EventTarget.h"
+#include "core/html/HTMLStyleElement.h"
+#include "core/page/RuntimeCSSEnabled.h"
+
+namespace WebCore {
+
+// FIXME: Next two functions look lifted verbatim from JSCSSStyleDeclarationCustom. Please remove duplication.
+
+// Check for a CSS prefix.
+// Passed prefix is all lowercase.
+// First character of the prefix within the property name may be upper or lowercase.
+// Other characters in the prefix within the property name must be lowercase.
+// The prefix within the property name must be followed by a capital letter.
+static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* prefix)
+{
+#ifndef NDEBUG
+ ASSERT(*prefix);
+ for (const char* p = prefix; *p; ++p)
+ ASSERT(isASCIILower(*p));
+ ASSERT(propertyName.length());
+#endif
+
+ if (toASCIILower(propertyName[0]) != prefix[0])
+ return false;
+
+ unsigned length = propertyName.length();
+ for (unsigned i = 1; i < length; ++i) {
+ if (!prefix[i])
+ return isASCIIUpper(propertyName[i]);
+ if (propertyName[i] != prefix[i])
+ return false;
+ }
+ return false;
+}
+
+// When getting properties on CSSStyleDeclarations, the name used from
+// Javascript and the actual name of the property are not the same, so
+// we have to do the following translation. The translation turns upper
+// case characters into lower case characters and inserts dashes to
+// separate words.
+//
+// Example: 'backgroundPositionY' -> 'background-position-y'
+//
+// Also, certain prefixes such as 'pos', 'css-' and 'pixel-' are stripped
+// and the hadPixelOrPosPrefix out parameter is used to indicate whether or
+// not the property name was prefixed with 'pos-' or 'pixel-'.
+CSSPropertyInfo* CSSStyleDeclaration::cssPropertyInfo(const String& propertyName)
+{
+ typedef HashMap<String, CSSPropertyInfo*> CSSPropertyInfoMap;
+ DEFINE_STATIC_LOCAL(CSSPropertyInfoMap, map, ());
+ CSSPropertyInfo* propInfo = map.get(propertyName);
+ if (!propInfo) {
+ unsigned length = propertyName.length();
+ bool hadPixelOrPosPrefix = false;
+ if (!length)
+ return 0;
+
+ StringBuilder builder;
+ builder.reserveCapacity(length);
+
+ unsigned i = 0;
+
+ if (hasCSSPropertyNamePrefix(propertyName, "css"))
+ i += 3;
+ else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) {
+ i += 5;
+ hadPixelOrPosPrefix = true;
+ } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) {
+ i += 3;
+ hadPixelOrPosPrefix = true;
+ } else if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
+ builder.append('-');
+ else if (isASCIIUpper(propertyName[0]))
+ return 0;
+
+ builder.append(toASCIILower(propertyName[i++]));
+
+ for (; i < length; ++i) {
+ UChar c = propertyName[i];
+ if (!isASCIIUpper(c))
+ builder.append(c);
+ else {
+ builder.append('-');
+ builder.append(toASCIILower(c));
+ }
+ }
+
+ String propName = builder.toString();
+ CSSPropertyID propertyID = cssPropertyID(propName);
+ if (propertyID && RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)) {
+ propInfo = new CSSPropertyInfo();
+ propInfo->hadPixelOrPosPrefix = hadPixelOrPosPrefix;
+ propInfo->propID = propertyID;
+ map.add(propertyName, propInfo);
+ }
+ }
+ return propInfo;
+}
+
+void CSSStyleDeclaration::anonymousNamedGetter(const AtomicString& name, bool& returnValue1Enabled, String& returnValue1, bool& returnValue2Enabled, float& returnValue2)
+{
+ // Search the style declaration.
+ CSSPropertyInfo* propInfo = cssPropertyInfo(name);
+
+ // Do not handle non-property names.
+ if (!propInfo)
+ return;
+
+ RefPtr<CSSValue> cssValue = getPropertyCSSValueInternal(static_cast<CSSPropertyID>(propInfo->propID));
+ if (cssValue) {
+ if (propInfo->hadPixelOrPosPrefix && cssValue->isPrimitiveValue()) {
+ returnValue2Enabled = true;
+ returnValue2 = static_cast<CSSPrimitiveValue*>(cssValue.get())->getFloatValue(CSSPrimitiveValue::CSS_PX);
+ return;
+ }
+ returnValue1Enabled = true;
+ returnValue1 = cssValue->cssText();
+ return;
+ }
+
+ String result = getPropertyValueInternal(static_cast<CSSPropertyID>(propInfo->propID));
+ if (result.isNull())
+ result = ""; // convert null to empty string.
+
+ returnValue1 = result;
+ returnValue1Enabled = true;
+}
+
+bool CSSStyleDeclaration::anonymousNamedSetter(const AtomicString& propertyName, const String& value, ExceptionCode& ec)
+{
+ String propertyValue = value;
+ CSSPropertyInfo* propInfo = CSSStyleDeclaration::cssPropertyInfo(propertyName);
+ if (!propInfo)
+ return false;
+
+ if (propInfo->hadPixelOrPosPrefix)
+ propertyValue.append("px");
+
+ this->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), propertyValue, false, ec);
+
+ return true;
+}
+
+} // namespace WebCore
diff --git a/Source/core/css/CSSStyleDeclaration.h b/Source/core/css/CSSStyleDeclaration.h
index a4a8062..c80bf0b 100644
--- a/Source/core/css/CSSStyleDeclaration.h
+++ b/Source/core/css/CSSStyleDeclaration.h
@@ -31,11 +31,18 @@
class CSSRule;
class CSSStyleSheet;
class CSSValue;
+class MutableStylePropertySet;
class StylePropertySet;
class StyledElement;
typedef int ExceptionCode;
+class CSSPropertyInfo {
+public:
+ CSSPropertyID propID;
+ bool hadPixelOrPosPrefix;
+};
+
class CSSStyleDeclaration : public ScriptWrappable {
WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); WTF_MAKE_FAST_ALLOCATED;
public:
@@ -64,12 +71,16 @@
virtual String getPropertyValueInternal(CSSPropertyID) = 0;
virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0;
- virtual PassRefPtr<StylePropertySet> copy() const = 0;
+ virtual PassRefPtr<MutableStylePropertySet> copyProperties() const = 0;
virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const = 0;
virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0;
+ void anonymousNamedGetter(const AtomicString& name, bool&, String&, bool&, float&);
+ bool anonymousNamedSetter(const AtomicString& name, const String& value, ExceptionCode&);
+
+ static CSSPropertyInfo* cssPropertyInfo(const String& propertyName);
protected:
CSSStyleDeclaration()
diff --git a/Source/core/css/CSSStyleDeclaration.idl b/Source/core/css/CSSStyleDeclaration.idl
index 9efa6b6..2d96596 100644
--- a/Source/core/css/CSSStyleDeclaration.idl
+++ b/Source/core/css/CSSStyleDeclaration.idl
@@ -20,11 +20,8 @@
// Introduced in DOM Level 2:
[
- CustomNamedSetter,
- CustomNamedGetter,
CustomEnumerateProperty,
- DependentLifetime,
- SkipVTableValidation
+ DependentLifetime
] interface CSSStyleDeclaration {
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException] attribute DOMString cssText;
@@ -38,6 +35,8 @@
readonly attribute unsigned long length;
getter DOMString item([Default=Undefined] optional unsigned long index);
+ [ImplementedAs=anonymousNamedGetter, TreatReturnedNullStringAs=Null] getter (DOMString or float) (DOMString name);
+ [ImplementedAs=anonymousNamedSetter, RaisesException] setter void (DOMString propertyName, [TreatNullAs=NullString] DOMString propertyValue);
readonly attribute CSSRule parentRule;
};
diff --git a/Source/core/css/CSSStyleRule.cpp b/Source/core/css/CSSStyleRule.cpp
index d27174a..ee4049c 100644
--- a/Source/core/css/CSSStyleRule.cpp
+++ b/Source/core/css/CSSStyleRule.cpp
@@ -28,7 +28,6 @@
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
-#include "core/dom/Document.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index e400e08..b6e9184 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -26,11 +26,9 @@
#include "HTMLNames.h"
#include "SVGNames.h"
#include "core/css/CSSCharsetRule.h"
-#include "core/css/CSSFontFaceRule.h"
#include "core/css/CSSImportRule.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSRuleList.h"
-#include "core/css/CSSStyleRule.h"
#include "core/css/MediaList.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleSheetContents.h"
@@ -38,7 +36,6 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/Node.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/loader/cache/CachedCSSStyleSheet.h"
#include "weborigin/SecurityOrigin.h"
namespace WebCore {
@@ -73,9 +70,7 @@
|| parentNode->isDocumentNode()
|| parentNode->hasTagName(HTMLNames::linkTag)
|| parentNode->hasTagName(HTMLNames::styleTag)
-#if ENABLE(SVG)
|| parentNode->hasTagName(SVGNames::styleTag)
-#endif
|| parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE;
}
#endif
@@ -87,14 +82,14 @@
PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> sheet, Node* ownerNode)
{
- return adoptRef(new CSSStyleSheet(sheet, ownerNode, false));
+ return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::minimumPosition()));
}
-PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KURL& baseURL, const String& encoding)
+PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KURL& baseURL, const TextPosition& startPosition, const String& encoding)
{
CSSParserContext parserContext(ownerNode->document(), baseURL, encoding);
RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string(), parserContext);
- return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true));
+ return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPosition));
}
CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportRule* ownerRule)
@@ -103,16 +98,18 @@
, m_isDisabled(false)
, m_ownerNode(0)
, m_ownerRule(ownerRule)
+ , m_startPosition(TextPosition::minimumPosition())
{
m_contents->registerClient(this);
}
-CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, Node* ownerNode, bool isInlineStylesheet)
+CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, Node* ownerNode, bool isInlineStylesheet, const TextPosition& startPosition)
: m_contents(contents)
, m_isInlineStylesheet(isInlineStylesheet)
, m_isDisabled(false)
, m_ownerNode(ownerNode)
, m_ownerRule(0)
+ , m_startPosition(startPosition)
{
ASSERT(isAcceptableCSSStyleSheetParent(ownerNode));
m_contents->registerClient(this);
@@ -277,7 +274,7 @@
ec = INDEX_SIZE_ERR;
return 0;
}
- CSSParser p(m_contents->parserContext());
+ CSSParser p(m_contents->parserContext(), UseCounter::getFrom(this));
RefPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleString);
if (!rule) {
diff --git a/Source/core/css/CSSStyleSheet.h b/Source/core/css/CSSStyleSheet.h
index 0a551a9..bcc6550 100644
--- a/Source/core/css/CSSStyleSheet.h
+++ b/Source/core/css/CSSStyleSheet.h
@@ -24,9 +24,10 @@
#include "core/css/CSSParserMode.h"
#include "core/css/CSSRule.h"
#include "core/css/StyleSheet.h"
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/AtomicStringHash.h>
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/text/AtomicStringHash.h"
+#include "wtf/text/TextPosition.h"
namespace WebCore {
@@ -48,7 +49,7 @@
public:
static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, CSSImportRule* ownerRule = 0);
static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, Node* ownerNode);
- static PassRefPtr<CSSStyleSheet> createInline(Node*, const KURL&, const String& encoding = String());
+ static PassRefPtr<CSSStyleSheet> createInline(Node*, const KURL&, const TextPosition& startPosition = TextPosition::minimumPosition(), const String& encoding = String());
virtual ~CSSStyleSheet();
@@ -105,11 +106,14 @@
StyleSheetContents* contents() const { return m_contents.get(); }
+ bool isInline() const { return m_isInlineStylesheet; }
+ TextPosition startPositionInSource() const { return m_startPosition; }
+
void reportMemoryUsage(MemoryObjectInfo*) const;
private:
CSSStyleSheet(PassRefPtr<StyleSheetContents>, CSSImportRule* ownerRule);
- CSSStyleSheet(PassRefPtr<StyleSheetContents>, Node* ownerNode, bool isInlineStylesheet);
+ CSSStyleSheet(PassRefPtr<StyleSheetContents>, Node* ownerNode, bool isInlineStylesheet, const TextPosition& startPosition);
virtual bool isCSSStyleSheet() const { return true; }
virtual String type() const { return "text/css"; }
@@ -125,6 +129,8 @@
Node* m_ownerNode;
CSSImportRule* m_ownerRule;
+ TextPosition m_startPosition;
+
mutable RefPtr<MediaList> m_mediaCSSOMWrapper;
mutable Vector<RefPtr<CSSRule> > m_childRuleCSSOMWrappers;
mutable OwnPtr<CSSRuleList> m_ruleListCSSOMWrapper;
diff --git a/Source/core/css/CSSStyleSheet.idl b/Source/core/css/CSSStyleSheet.idl
index 7ab434f..62350f5 100644
--- a/Source/core/css/CSSStyleSheet.idl
+++ b/Source/core/css/CSSStyleSheet.idl
@@ -20,7 +20,7 @@
// Introduced in DOM Level 2:
[
- GenerateIsReachable=ImplOwnerNodeRoot
+ GenerateIsReachable=ownerNode
] interface CSSStyleSheet : StyleSheet {
readonly attribute CSSRule ownerRule;
readonly attribute CSSRuleList cssRules;
diff --git a/Source/core/css/CSSSupportsRule.cpp b/Source/core/css/CSSSupportsRule.cpp
index 28c6b1a..8c96b05 100644
--- a/Source/core/css/CSSSupportsRule.cpp
+++ b/Source/core/css/CSSSupportsRule.cpp
@@ -29,13 +29,8 @@
#include "config.h"
#include "core/css/CSSSupportsRule.h"
-#include "core/css/CSSParser.h"
#include "core/css/CSSRule.h"
-#include "core/css/CSSRuleList.h"
-#include "core/css/CSSStyleSheet.h"
#include "core/css/StyleRule.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/CSSSupportsRule.idl b/Source/core/css/CSSSupportsRule.idl
index c4c328d..b2aa0cc 100644
--- a/Source/core/css/CSSSupportsRule.idl
+++ b/Source/core/css/CSSSupportsRule.idl
@@ -27,7 +27,7 @@
*/
[
- NoInterfaceObject,
+ NoInterfaceObject
] interface CSSSupportsRule : CSSRule {
readonly attribute CSSRuleList cssRules;
readonly attribute DOMString conditionText;
diff --git a/Source/core/css/CSSToStyleMap.cpp b/Source/core/css/CSSToStyleMap.cpp
index e9960c3..4b45996 100644
--- a/Source/core/css/CSSToStyleMap.cpp
+++ b/Source/core/css/CSSToStyleMap.cpp
@@ -466,16 +466,16 @@
animation->setTimingFunction(LinearTimingFunction::create());
break;
case CSSValueEase:
- animation->setTimingFunction(CubicBezierTimingFunction::create());
+ animation->setTimingFunction(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease));
break;
case CSSValueEaseIn:
- animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseIn));
+ animation->setTimingFunction(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn));
break;
case CSSValueEaseOut:
- animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseOut));
+ animation->setTimingFunction(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut));
break;
case CSSValueEaseInOut:
- animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseInOut));
+ animation->setTimingFunction(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseInOut));
break;
case CSSValueStepStart:
animation->setTimingFunction(StepsTimingFunction::create(1, true));
diff --git a/Source/core/css/CSSValue.cpp b/Source/core/css/CSSValue.cpp
index d912e4e..802cd93 100644
--- a/Source/core/css/CSSValue.cpp
+++ b/Source/core/css/CSSValue.cpp
@@ -36,7 +36,6 @@
#include "core/css/CSSFontFaceSrcValue.h"
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGradientValue.h"
-#include "core/css/CSSImageGeneratorValue.h"
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSImageValue.h"
#include "core/css/CSSInheritedValue.h"
@@ -54,16 +53,13 @@
#include "core/css/WebKitCSSArrayFunctionValue.h"
#include "core/css/WebKitCSSFilterValue.h"
#include "core/css/WebKitCSSMixFunctionValue.h"
+#include "core/css/WebKitCSSSVGDocumentValue.h"
#include "core/css/WebKitCSSShaderValue.h"
#include "core/css/WebKitCSSTransformValue.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/svg/SVGColor.h"
#include "core/svg/SVGPaint.h"
-#if ENABLE(SVG)
-#include "core/css/WebKitCSSSVGDocumentValue.h"
-#endif
-
namespace WebCore {
struct SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> {
@@ -238,7 +234,6 @@
case VariableClass:
static_cast<const CSSVariableValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
return;
-#if ENABLE(SVG)
case SVGColorClass:
static_cast<const SVGColor*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
return;
@@ -248,7 +243,6 @@
case WebKitCSSSVGDocumentClass:
static_cast<const WebKitCSSSVGDocumentValue*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
return;
-#endif
case ValueListClass:
toCSSValueList(this)->reportDescendantMemoryUsage(memoryObjectInfo);
return;
@@ -342,14 +336,12 @@
return compareCSSValues<WebKitCSSShaderValue>(*this, other);
case VariableClass:
return compareCSSValues<CSSVariableValue>(*this, other);
-#if ENABLE(SVG)
case SVGColorClass:
return compareCSSValues<SVGColor>(*this, other);
case SVGPaintClass:
return compareCSSValues<SVGPaint>(*this, other);
case WebKitCSSSVGDocumentClass:
return compareCSSValues<WebKitCSSSVGDocumentValue>(*this, other);
-#endif
default:
ASSERT_NOT_REACHED();
return false;
@@ -432,14 +424,12 @@
return static_cast<const WebKitCSSShaderValue*>(this)->customCssText();
case VariableClass:
return static_cast<const CSSVariableValue*>(this)->value();
-#if ENABLE(SVG)
case SVGColorClass:
return static_cast<const SVGColor*>(this)->customCssText();
case SVGPaintClass:
return static_cast<const SVGPaint*>(this)->customCssText();
case WebKitCSSSVGDocumentClass:
return static_cast<const WebKitCSSSVGDocumentValue*>(this)->customCssText();
-#endif
}
ASSERT_NOT_REACHED();
return String();
@@ -564,7 +554,6 @@
case VariableClass:
delete static_cast<CSSVariableValue*>(this);
return;
-#if ENABLE(SVG)
case SVGColorClass:
delete static_cast<SVGColor*>(this);
return;
@@ -574,7 +563,6 @@
case WebKitCSSSVGDocumentClass:
delete static_cast<WebKitCSSSVGDocumentValue*>(this);
return;
-#endif
}
ASSERT_NOT_REACHED();
}
@@ -599,12 +587,10 @@
return static_cast<const WebKitCSSTransformValue*>(this)->cloneForCSSOM();
case ImageSetClass:
return static_cast<const CSSImageSetValue*>(this)->cloneForCSSOM();
-#if ENABLE(SVG)
case SVGColorClass:
return static_cast<const SVGColor*>(this)->cloneForCSSOM();
case SVGPaintClass:
return static_cast<const SVGPaint*>(this)->cloneForCSSOM();
-#endif
default:
ASSERT(!isSubtypeExposedToCSSOM());
return TextCloneCSSValue::create(classType(), cssText());
diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h
index 5f048ea..0de2548 100644
--- a/Source/core/css/CSSValue.h
+++ b/Source/core/css/CSSValue.h
@@ -91,20 +91,14 @@
bool isWebKitCSSMixFunctionValue() const { return m_classType == WebKitCSSMixFunctionValueClass; }
bool isWebKitCSSShaderValue() const { return m_classType == WebKitCSSShaderClass; }
bool isVariableValue() const { return m_classType == VariableClass; }
-#if ENABLE(SVG)
bool isSVGColor() const { return m_classType == SVGColorClass || m_classType == SVGPaintClass; }
bool isSVGPaint() const { return m_classType == SVGPaintClass; }
bool isWebKitCSSSVGDocumentValue() const { return m_classType == WebKitCSSSVGDocumentClass; }
-#endif
bool isCSSOMSafe() const { return m_isCSSOMSafe; }
bool isSubtypeExposedToCSSOM() const
{
- return isPrimitiveValue()
-#if ENABLE(SVG)
- || isSVGColor()
-#endif
- || isValueList();
+ return isPrimitiveValue() || isSVGColor() || isValueList();
}
PassRefPtr<CSSValue> cloneForCSSOM() const;
@@ -156,11 +150,11 @@
CalculationClass,
WebKitCSSShaderClass,
VariableClass,
-#if ENABLE(SVG)
+
+ // SVG classes.
SVGColorClass,
SVGPaintClass,
WebKitCSSSVGDocumentClass,
-#endif
// List class types must appear after ValueListClass.
ValueListClass,
diff --git a/Source/core/css/CSSValue.idl b/Source/core/css/CSSValue.idl
index 5440b74..e8a4a13 100644
--- a/Source/core/css/CSSValue.idl
+++ b/Source/core/css/CSSValue.idl
@@ -21,8 +21,7 @@
[
CustomToV8,
- DependentLifetime,
- ImplementationLacksVTable
+ DependentLifetime
] interface CSSValue {
// UnitTypes
diff --git a/Source/core/css/CSSValueKeywords.in b/Source/core/css/CSSValueKeywords.in
index ff82d6e..f13c08d 100644
--- a/Source/core/css/CSSValueKeywords.in
+++ b/Source/core/css/CSSValueKeywords.in
@@ -1,6 +1,7 @@
//
// CSS value names
//
+
inherit
initial
//
@@ -452,9 +453,7 @@
thick
thin
underline
-#if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT
-wavy
-#endif
+wavy condition=CSS3_TEXT
-webkit-nowrap
// CSS3 Values
@@ -772,12 +771,11 @@
document
reset
-#if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION
//
// CSS_PROP_USER_ZOOM
//
// fixed
-zoom
+zoom condition=CSS_DEVICE_ADAPTATION
//
// CSS_PROP_MIN_WIDTH
@@ -786,9 +784,8 @@
// CSS_PROP_MAX_HEIGHT
//
// auto
-device-width
-device-height
-#endif
+device-width condition=CSS_DEVICE_ADAPTATION
+device-height condition=CSS_DEVICE_ADAPTATION
//
// CSS_PROP_POINTER_EVENTS
@@ -848,11 +845,9 @@
manual
// auto
-#if defined(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) && ENABLE_ACCELERATED_OVERFLOW_SCROLLING
// -webkit-overflow-scrolling
// auto
-touch
-#endif
+touch condition=ACCELERATED_OVERFLOW_SCROLLING
// -webkit-writing-mode
// SVG compatibility
@@ -942,9 +937,7 @@
// -webkit-line-align
edges
-#if (defined(ENABLE_SVG) && ENABLE_SVG) || (defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT)
-alphabetic
-#endif
+alphabetic condition=SVG
// position
sticky
@@ -990,8 +983,9 @@
// -webkit-grid-{start|end|before|after}
span
-#if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT
// text-indent
--webkit-each-line
-#endif
+-webkit-each-line condition=CSS3_TEXT
+// (scan:) media feature
+progressive
+interlace
diff --git a/Source/core/css/CSSValueList.idl b/Source/core/css/CSSValueList.idl
index ca51d6c..7d0b63e 100644
--- a/Source/core/css/CSSValueList.idl
+++ b/Source/core/css/CSSValueList.idl
@@ -25,7 +25,6 @@
// Introduced in DOM Level 2:
[
- ImplementationLacksVTable
] interface CSSValueList : CSSValue {
readonly attribute unsigned long length;
getter CSSValue item([Default=Undefined] optional unsigned long index);
diff --git a/Source/core/css/CSSValuePool.cpp b/Source/core/css/CSSValuePool.cpp
index c759c66..4c5d8ef 100644
--- a/Source/core/css/CSSValuePool.cpp
+++ b/Source/core/css/CSSValuePool.cpp
@@ -28,7 +28,6 @@
#include "CSSValueKeywords.h"
#include "core/css/CSSParser.h"
-#include "core/css/CSSStyleSheet.h"
#include "core/css/CSSValueList.h"
namespace WebCore {
diff --git a/Source/core/css/Counter.idl b/Source/core/css/Counter.idl
index aff8b56..7006aa5 100644
--- a/Source/core/css/Counter.idl
+++ b/Source/core/css/Counter.idl
@@ -19,7 +19,6 @@
// Introduced in DOM Level 2:
[
- ImplementationLacksVTable
] interface Counter {
readonly attribute DOMString identifier;
readonly attribute DOMString listStyle;
diff --git a/Source/core/css/DOMWindowCSS.cpp b/Source/core/css/DOMWindowCSS.cpp
index 406cde7..4f37fb0 100644
--- a/Source/core/css/DOMWindowCSS.cpp
+++ b/Source/core/css/DOMWindowCSS.cpp
@@ -74,7 +74,7 @@
if (normalizedValue.isEmpty())
return false;
- RefPtr<StylePropertySet> dummyStyle = StylePropertySet::create();
+ RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::create();
return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, 0);
}
diff --git a/Source/core/css/DeprecatedStyleBuilder.cpp b/Source/core/css/DeprecatedStyleBuilder.cpp
index 6b37bd2..866ab61 100644
--- a/Source/core/css/DeprecatedStyleBuilder.cpp
+++ b/Source/core/css/DeprecatedStyleBuilder.cpp
@@ -39,7 +39,6 @@
#include "core/dom/Element.h"
#include "core/page/Settings.h"
#include "core/rendering/ClipPathOperation.h"
-#include "core/rendering/RenderObject.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/style/BasicShapes.h"
#include "core/rendering/style/CursorList.h"
@@ -1241,7 +1240,7 @@
public:
static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
{
- ETextDecoration t = RenderStyle::initialTextDecoration();
+ TextDecoration t = RenderStyle::initialTextDecoration();
for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
CSSValue* item = i.value();
t |= *toCSSPrimitiveValue(item);
@@ -1250,7 +1249,7 @@
}
static PropertyHandler createHandler()
{
- PropertyHandler handler = ApplyPropertyDefaultBase<ETextDecoration, &RenderStyle::textDecoration, ETextDecoration, &RenderStyle::setTextDecoration, ETextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
+ PropertyHandler handler = ApplyPropertyDefaultBase<TextDecoration, &RenderStyle::textDecoration, TextDecoration, &RenderStyle::setTextDecoration, TextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
}
};
@@ -1860,13 +1859,8 @@
private:
static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
{
-#if ENABLE(SVG)
if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)
return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
-#else
- UNUSED_PARAM(styleResolver);
- UNUSED_PARAM(displayPropertyValue);
-#endif
return true;
}
public:
@@ -1914,15 +1908,12 @@
setValue(styleResolver->style(), 0);
else if (primitiveValue->isShape()) {
setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
- }
-#if ENABLE(SVG)
- else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
+ } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
String cssURLValue = primitiveValue->getStringValue();
KURL url = styleResolver->document()->completeURL(cssURLValue);
// FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
}
-#endif
}
}
static PropertyHandler createHandler()
@@ -2034,29 +2025,20 @@
setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
- setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
- setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<BorderImage, Slice>::createHandler());
setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
- setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
- setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
- setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault<ECaptionSide, &RenderStyle::captionSide, ECaptionSide, &RenderStyle::setCaptionSide, ECaptionSide, &RenderStyle::initialCaptionSide>::createHandler());
- setPropertyHandler(CSSPropertyClear, ApplyPropertyDefault<EClear, &RenderStyle::clear, EClear, &RenderStyle::setClear, EClear, &RenderStyle::initialClear>::createHandler());
setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
@@ -2064,71 +2046,31 @@
setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
- setPropertyHandler(CSSPropertyEmptyCells, ApplyPropertyDefault<EEmptyCell, &RenderStyle::emptyCells, EEmptyCell, &RenderStyle::setEmptyCells, EEmptyCell, &RenderStyle::initialEmptyCells>::createHandler());
- setPropertyHandler(CSSPropertyFloat, ApplyPropertyDefault<EFloat, &RenderStyle::floating, EFloat, &RenderStyle::setFloating, EFloat, &RenderStyle::initialFloating>::createHandler());
setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
- setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
- setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
- setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
- setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault<EListStylePosition, &RenderStyle::listStylePosition, EListStylePosition, &RenderStyle::setListStylePosition, EListStylePosition, &RenderStyle::initialListStylePosition>::createHandler());
- setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault<EListStyleType, &RenderStyle::listStyleType, EListStyleType, &RenderStyle::setListStyleType, EListStyleType, &RenderStyle::initialListStyleType>::createHandler());
- setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler());
- setPropertyHandler(CSSPropertyMixBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
- setPropertyHandler(CSSPropertyOpacity, ApplyPropertyDefault<float, &RenderStyle::opacity, float, &RenderStyle::setOpacity, float, &RenderStyle::initialOpacity>::createHandler());
setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
- setPropertyHandler(CSSPropertyOverflowWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
- setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowX, EOverflow, &RenderStyle::setOverflowX, EOverflow, &RenderStyle::initialOverflowX>::createHandler());
- setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowY, EOverflow, &RenderStyle::setOverflowY, EOverflow, &RenderStyle::initialOverflowY>::createHandler());
- setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
- setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
- setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
- setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
- setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakAfter, EPageBreak, &RenderStyle::setPageBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakBefore, EPageBreak, &RenderStyle::setPageBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakInside, EPageBreak, &RenderStyle::setPageBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyPointerEvents, ApplyPropertyDefault<EPointerEvents, &RenderStyle::pointerEvents, EPointerEvents, &RenderStyle::setPointerEvents, EPointerEvents, &RenderStyle::initialPointerEvents>::createHandler());
- setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault<EPosition, &RenderStyle::position, EPosition, &RenderStyle::setPosition, EPosition, &RenderStyle::initialPosition>::createHandler());
setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
- setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
- setPropertyHandler(CSSPropertySpeak, ApplyPropertyDefault<ESpeak, &RenderStyle::speak, ESpeak, &RenderStyle::setSpeak, ESpeak, &RenderStyle::initialSpeak>::createHandler());
- setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault<ETableLayout, &RenderStyle::tableLayout, ETableLayout, &RenderStyle::setTableLayout, ETableLayout, &RenderStyle::initialTableLayout>::createHandler());
- setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault<unsigned, &RenderStyle::tabSize, unsigned, &RenderStyle::setTabSize, unsigned, &RenderStyle::initialTabSize>::createHandler());
setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
#if ENABLE(CSS3_TEXT)
setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
- setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
#endif // CSS3_TEXT
setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
- setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
- setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault<ETextTransform, &RenderStyle::textTransform, ETextTransform, &RenderStyle::setTextTransform, ETextTransform, &RenderStyle::initialTextTransform>::createHandler());
- setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
- setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &CSSAnimationData::delay, &CSSAnimationData::setDelay, &CSSAnimationData::isDelaySet, &CSSAnimationData::clearDelay, &CSSAnimationData::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<CSSAnimationData::AnimationDirection, &CSSAnimationData::direction, &CSSAnimationData::setDirection, &CSSAnimationData::isDirectionSet, &CSSAnimationData::clearDirection, &CSSAnimationData::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &CSSAnimationData::duration, &CSSAnimationData::setDuration, &CSSAnimationData::isDurationSet, &CSSAnimationData::clearDuration, &CSSAnimationData::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
@@ -2137,50 +2079,19 @@
setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &CSSAnimationData::name, &CSSAnimationData::setName, &CSSAnimationData::isNameSet, &CSSAnimationData::clearName, &CSSAnimationData::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &CSSAnimationData::playState, &CSSAnimationData::setPlayState, &CSSAnimationData::isPlayStateSet, &CSSAnimationData::clearPlayState, &CSSAnimationData::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &CSSAnimationData::timingFunction, &CSSAnimationData::setTimingFunction, &CSSAnimationData::isTimingFunctionSet, &CSSAnimationData::clearTimingFunction, &CSSAnimationData::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
- setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault<ControlPart, &RenderStyle::appearance, ControlPart, &RenderStyle::setAppearance, ControlPart, &RenderStyle::initialAppearance>::createHandler());
setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
- setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault<EBackfaceVisibility, &RenderStyle::backfaceVisibility, EBackfaceVisibility, &RenderStyle::setBackfaceVisibility, EBackfaceVisibility, &RenderStyle::initialBackfaceVisibility>::createHandler());
setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
- setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler());
setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<BorderImage, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault<EBoxAlignment, &RenderStyle::boxAlign, EBoxAlignment, &RenderStyle::setBoxAlign, EBoxAlignment, &RenderStyle::initialBoxAlign>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxDecorationBreak, ApplyPropertyDefault<EBoxDecorationBreak, &RenderStyle::boxDecorationBreak, EBoxDecorationBreak, &RenderStyle::setBoxDecorationBreak, EBoxDecorationBreak, &RenderStyle::initialBoxDecorationBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault<EBoxDirection, &RenderStyle::boxDirection, EBoxDirection, &RenderStyle::setBoxDirection, EBoxDirection, &RenderStyle::initialBoxDirection>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault<float, &RenderStyle::boxFlex, float, &RenderStyle::setBoxFlex, float, &RenderStyle::initialBoxFlex>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxFlexGroup, unsigned int, &RenderStyle::setBoxFlexGroup, unsigned int, &RenderStyle::initialBoxFlexGroup>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault<EBoxLines, &RenderStyle::boxLines, EBoxLines, &RenderStyle::setBoxLines, EBoxLines, &RenderStyle::initialBoxLines>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxOrdinalGroup, unsigned int, &RenderStyle::setBoxOrdinalGroup, unsigned int, &RenderStyle::initialBoxOrdinalGroup>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault<EBoxOrient, &RenderStyle::boxOrient, EBoxOrient, &RenderStyle::setBoxOrient, EBoxOrient, &RenderStyle::initialBoxOrient>::createHandler());
- setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault<EBoxPack, &RenderStyle::boxPack, EBoxPack, &RenderStyle::setBoxPack, EBoxPack, &RenderStyle::initialBoxPack>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColorCorrection, ApplyPropertyDefault<ColorSpace, &RenderStyle::colorSpace, ColorSpace, &RenderStyle::setColorSpace, ColorSpace, &RenderStyle::initialColorSpace>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnAxis, ApplyPropertyDefault<ColumnAxis, &RenderStyle::columnAxis, ColumnAxis, &RenderStyle::setColumnAxis, ColumnAxis, &RenderStyle::initialColumnAxis>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakAfter, EPageBreak, &RenderStyle::setColumnBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakBefore, EPageBreak, &RenderStyle::setColumnBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakInside, EPageBreak, &RenderStyle::setColumnBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnProgression, ApplyPropertyDefault<ColumnProgression, &RenderStyle::columnProgression, ColumnProgression, &RenderStyle::setColumnProgression, ColumnProgression, &RenderStyle::initialColumnProgression>::createHandler());
setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault<ColumnSpan, &RenderStyle::columnSpan, ColumnSpan, &RenderStyle::setColumnSpan, ColumnSpan, &RenderStyle::initialColumnSpan>::createHandler());
- setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
- setPropertyHandler(CSSPropertyWebkitAlignContent, ApplyPropertyDefault<EAlignContent, &RenderStyle::alignContent, EAlignContent, &RenderStyle::setAlignContent, EAlignContent, &RenderStyle::initialAlignContent>::createHandler());
- setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler());
- setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler());
- setPropertyHandler(CSSPropertyWebkitFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
- setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
- setPropertyHandler(CSSPropertyWebkitFlexGrow, ApplyPropertyDefault<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::createHandler());
- setPropertyHandler(CSSPropertyWebkitFlexShrink, ApplyPropertyDefault<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::createHandler());
- setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
- setPropertyHandler(CSSPropertyWebkitGridAutoFlow, ApplyPropertyDefault<GridAutoFlow, &RenderStyle::gridAutoFlow, GridAutoFlow, &RenderStyle::setGridAutoFlow, GridAutoFlow, &RenderStyle::initialGridAutoFlow>::createHandler());
- setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler());
- setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<int, &RenderStyle::order, int, &RenderStyle::setOrder, int, &RenderStyle::initialOrder>::createHandler());
setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
@@ -2191,21 +2102,10 @@
setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitAfter, &RenderStyle::setHyphenationLimitAfter, &RenderStyle::initialHyphenationLimitAfter>::createHandler());
setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitBefore, &RenderStyle::setHyphenationLimitBefore, &RenderStyle::initialHyphenationLimitBefore>::createHandler());
setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
- setPropertyHandler(CSSPropertyWebkitHyphens, ApplyPropertyDefault<Hyphens, &RenderStyle::hyphens, Hyphens, &RenderStyle::setHyphens, Hyphens, &RenderStyle::initialHyphens>::createHandler());
- setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault<LineAlign, &RenderStyle::lineAlign, LineAlign, &RenderStyle::setLineAlign, LineAlign, &RenderStyle::initialLineAlign>::createHandler());
- setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<LineBreak, &RenderStyle::lineBreak, LineBreak, &RenderStyle::setLineBreak, LineBreak, &RenderStyle::initialLineBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitLineClamp, ApplyPropertyDefault<const LineClampValue&, &RenderStyle::lineClamp, LineClampValue, &RenderStyle::setLineClamp, LineClampValue, &RenderStyle::initialLineClamp>::createHandler());
setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
- setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault<LineSnap, &RenderStyle::lineSnap, LineSnap, &RenderStyle::setLineSnap, LineSnap, &RenderStyle::initialLineSnap>::createHandler());
- setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginAfterCollapse, EMarginCollapse, &RenderStyle::setMarginAfterCollapse, EMarginCollapse, &RenderStyle::initialMarginAfterCollapse>::createHandler());
- setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginBeforeCollapse, EMarginCollapse, &RenderStyle::setMarginBeforeCollapse, EMarginCollapse, &RenderStyle::initialMarginBeforeCollapse>::createHandler());
- setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
- setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
- setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler());
setPropertyHandler(CSSPropertyWebkitMarqueeIncrement, ApplyPropertyMarqueeIncrement::createHandler());
setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
- setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<BorderMask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<BorderMask, Repeat>::createHandler());
@@ -2222,47 +2122,20 @@
setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
- setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
- setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
- setPropertyHandler(CSSPropertyWebkitPrintColorAdjust, ApplyPropertyDefault<PrintColorAdjust, &RenderStyle::printColorAdjust, PrintColorAdjust, &RenderStyle::setPrintColorAdjust, PrintColorAdjust, &RenderStyle::initialPrintColorAdjust>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRegionBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakAfter, EPageBreak, &RenderStyle::setRegionBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRegionBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakBefore, EPageBreak, &RenderStyle::setRegionBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRegionBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakInside, EPageBreak, &RenderStyle::setRegionBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault<RegionOverflow, &RenderStyle::regionOverflow, RegionOverflow, &RenderStyle::setRegionOverflow, RegionOverflow, &RenderStyle::initialRegionOverflow>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler());
- setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTextSecurity, ApplyPropertyDefault<ETextSecurity, &RenderStyle::textSecurity, ETextSecurity, &RenderStyle::setTextSecurity, ETextSecurity, &RenderStyle::initialTextSecurity>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
- setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault<ETransformStyle3D, &RenderStyle::transformStyle3D, ETransformStyle3D, &RenderStyle::setTransformStyle3D, ETransformStyle3D, &RenderStyle::initialTransformStyle3D>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &CSSAnimationData::delay, &CSSAnimationData::setDelay, &CSSAnimationData::isDelaySet, &CSSAnimationData::clearDelay, &CSSAnimationData::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &CSSAnimationData::duration, &CSSAnimationData::setDuration, &CSSAnimationData::isDurationSet, &CSSAnimationData::clearDuration, &CSSAnimationData::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &CSSAnimationData::property, &CSSAnimationData::setProperty, &CSSAnimationData::isPropertySet, &CSSAnimationData::clearProperty, &CSSAnimationData::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &CSSAnimationData::timingFunction, &CSSAnimationData::setTimingFunction, &CSSAnimationData::isTimingFunctionSet, &CSSAnimationData::clearTimingFunction, &CSSAnimationData::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
- setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault<EUserDrag, &RenderStyle::userDrag, EUserDrag, &RenderStyle::setUserDrag, EUserDrag, &RenderStyle::initialUserDrag>::createHandler());
- setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler());
- setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler());
setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
- setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault<WrapFlow, &RenderStyle::wrapFlow, WrapFlow, &RenderStyle::setWrapFlow, WrapFlow, &RenderStyle::initialWrapFlow>::createHandler());
- setPropertyHandler(CSSPropertyWebkitShapeMargin, ApplyPropertyLength<&RenderStyle::shapeMargin, &RenderStyle::setShapeMargin, &RenderStyle::initialShapeMargin>::createHandler());
- setPropertyHandler(CSSPropertyWebkitShapePadding, ApplyPropertyLength<&RenderStyle::shapePadding, &RenderStyle::setShapePadding, &RenderStyle::initialShapePadding>::createHandler());
- setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler());
setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
- setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
- setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
- setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
- // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
- setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
}
diff --git a/Source/core/css/DocumentRuleSets.cpp b/Source/core/css/DocumentRuleSets.cpp
index 0788651..213e9fb 100644
--- a/Source/core/css/DocumentRuleSets.cpp
+++ b/Source/core/css/DocumentRuleSets.cpp
@@ -35,6 +35,8 @@
#include "core/css/StyleSheetContents.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
namespace WebCore {
@@ -94,82 +96,32 @@
}
}
-static PassOwnPtr<RuleSet> makeRuleSet(const Vector<RuleFeature>& rules)
-{
- size_t size = rules.size();
- if (!size)
- return nullptr;
- OwnPtr<RuleSet> ruleSet = RuleSet::create();
- for (size_t i = 0; i < size; ++i)
- ruleSet->addRule(rules[i].rule, rules[i].selectorIndex, rules[i].hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState);
- ruleSet->shrinkToFit();
- return ruleSet.release();
-}
-
void DocumentRuleSets::resetAuthorStyle()
{
- m_authorStyle = RuleSet::create();
- m_authorStyle->disableAutoShrinkToFit();
m_shadowDistributedRules.clear();
}
-void DocumentRuleSets::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >& styleSheets, MediaQueryEvaluator* medium, InspectorCSSOMWrappers& inspectorCSSOMWrappers, bool isViewSource, StyleResolver* resolver)
+void DocumentRuleSets::collectFeaturesTo(RuleFeatureSet& features, bool isViewSource)
{
- // This handles sheets added to the end of the stylesheet list only. In other cases the style resolver
- // needs to be reconstructed. To handle insertions too the rule order numbers would need to be updated.
- unsigned size = styleSheets.size();
- for (unsigned i = firstNew; i < size; ++i) {
- CSSStyleSheet* cssSheet = styleSheets[i].get();
- ASSERT(!cssSheet->disabled());
- if (cssSheet->mediaQueries() && !medium->eval(cssSheet->mediaQueries(), resolver))
- continue;
- StyleSheetContents* sheet = cssSheet->contents();
- if (const ContainerNode* scope = ScopedStyleResolver::scopeFor(cssSheet)) {
- // FIXME: Remove a dependency to calling a StyleResolver's member function.
- // If we can avoid calling resolver->ensureScopeResolver() here, we don't have to include "core/css/resolver/StyleResolver.h".
- // https://bugs.webkit.org/show_bug.cgi?id=108890
- resolver->ensureScopeResolver()->ensureRuleSetFor(scope)->addRulesFromSheet(sheet, *medium, resolver, scope);
- inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet);
- continue;
- }
- m_authorStyle->addRulesFromSheet(sheet, *medium, resolver);
- inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet);
- }
- m_authorStyle->shrinkToFit();
- collectFeatures(isViewSource, resolver->scopeResolver());
-}
-
-void DocumentRuleSets::collectFeatures(bool isViewSource, ScopedStyleResolver* scopeResolver)
-{
- m_features.clear();
// Collect all ids and rules using sibling selectors (:first-child and similar)
// in the current set of stylesheets. Style sharing code uses this information to reject
// sharing candidates.
if (CSSDefaultStyleSheets::defaultStyle)
- m_features.add(CSSDefaultStyleSheets::defaultStyle->features());
- if (m_authorStyle)
- m_features.add(m_authorStyle->features());
+ features.add(CSSDefaultStyleSheets::defaultStyle->features());
+
if (isViewSource)
- m_features.add(CSSDefaultStyleSheets::viewSourceStyle()->features());
+ features.add(CSSDefaultStyleSheets::viewSourceStyle()->features());
- if (scopeResolver)
- scopeResolver->collectFeaturesTo(m_features);
if (m_userStyle)
- m_features.add(m_userStyle->features());
- m_shadowDistributedRules.collectFeaturesTo(m_features);
+ features.add(m_userStyle->features());
- m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
- m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
+ m_shadowDistributedRules.collectFeaturesTo(features);
}
void DocumentRuleSets::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addMember(m_authorStyle, "authorStyle");
info.addMember(m_userStyle, "userStyle");
- info.addMember(m_features, "features");
- info.addMember(m_siblingRuleSet, "siblingRuleSet");
- info.addMember(m_uncommonAttributeRuleSet, "uncommonAttributeRuleSet");
info.addMember(m_shadowDistributedRules, "shadowDistributedRules");
}
diff --git a/Source/core/css/DocumentRuleSets.h b/Source/core/css/DocumentRuleSets.h
index f843cdd..77a024d 100644
--- a/Source/core/css/DocumentRuleSets.h
+++ b/Source/core/css/DocumentRuleSets.h
@@ -39,7 +39,6 @@
class MatchRequest;
class MediaQueryEvaluator;
class RuleSet;
-class ScopedStyleResolver;
class ShadowDistributedRules {
public:
@@ -59,28 +58,18 @@
public:
DocumentRuleSets();
~DocumentRuleSets();
- RuleSet* authorStyle() const { return m_authorStyle.get(); }
RuleSet* userStyle() const { return m_userStyle.get(); }
- RuleFeatureSet& features() { return m_features; }
- const RuleFeatureSet& features() const { return m_features; }
- RuleSet* sibling() const { return m_siblingRuleSet.get(); }
- RuleSet* uncommonAttribute() const { return m_uncommonAttributeRuleSet.get(); }
void initUserStyle(DocumentStyleSheetCollection*, const MediaQueryEvaluator&, StyleResolver&);
void resetAuthorStyle();
- void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, bool isViewSource, StyleResolver*);
+ void collectFeaturesTo(RuleFeatureSet&, bool isViewSource);
- void collectFeatures(bool isViewSource, ScopedStyleResolver*);
void reportMemoryUsage(MemoryObjectInfo*) const;
ShadowDistributedRules& shadowDistributedRules() { return m_shadowDistributedRules; }
private:
void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&, RuleSet& userStyle, const MediaQueryEvaluator&, StyleResolver&);
- OwnPtr<RuleSet> m_authorStyle;
OwnPtr<RuleSet> m_userStyle;
- RuleFeatureSet m_features;
- OwnPtr<RuleSet> m_siblingRuleSet;
- OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
ShadowDistributedRules m_shadowDistributedRules;
};
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index 06b2156..a89f953 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -29,19 +29,13 @@
#include "config.h"
#include "core/css/ElementRuleCollector.h"
-#include "CSSValueKeywords.h"
-#include "core/css/CSSDefaultStyleSheets.h"
-#include "core/css/CSSRule.h"
#include "core/css/CSSRuleList.h"
#include "core/css/CSSSelector.h"
-#include "core/css/CSSSelectorList.h"
#include "core/css/SelectorCheckerFastPath.h"
#include "core/css/SiblingTraversalStrategies.h"
#include "core/css/StylePropertySet.h"
#include "core/dom/StyledElement.h"
-#include "core/html/HTMLElement.h"
#include "core/rendering/RenderRegion.h"
-#include "core/svg/SVGElement.h"
#include <wtf/TemporaryChange.h>
diff --git a/Source/core/css/ElementRuleCollector.h b/Source/core/css/ElementRuleCollector.h
index a95206e..4f34110 100644
--- a/Source/core/css/ElementRuleCollector.h
+++ b/Source/core/css/ElementRuleCollector.h
@@ -50,7 +50,8 @@
, m_sameOriginOnly(false)
, m_mode(SelectorChecker::ResolvingStyle)
, m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(state.parentNode()))
- , m_behaviorAtBoundary(SelectorChecker::DoesNotCrossBoundary) { }
+ , m_behaviorAtBoundary(SelectorChecker::DoesNotCrossBoundary)
+ , m_matchingUARules(false) { }
void setBehaviorAtBoundary(SelectorChecker::BehaviorAtBoundary boundary) { m_behaviorAtBoundary = boundary; }
SelectorChecker::BehaviorAtBoundary behaviorAtBoundary() const { return m_behaviorAtBoundary; }
diff --git a/Source/core/css/FontFeatureValue.cpp b/Source/core/css/FontFeatureValue.cpp
index 1d7485e..28e352d 100644
--- a/Source/core/css/FontFeatureValue.cpp
+++ b/Source/core/css/FontFeatureValue.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "core/css/FontFeatureValue.h"
-#include "CSSValueKeywords.h"
-#include "core/css/CSSParser.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/text/StringBuilder.h>
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp
index c731791..564cfd8 100644
--- a/Source/core/css/FontLoader.cpp
+++ b/Source/core/css/FontLoader.cpp
@@ -306,7 +306,7 @@
bool FontLoader::resolveFontStyle(const String& fontString, Font& font)
{
// Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D.
- RefPtr<StylePropertySet> parsedStyle = StylePropertySet::create();
+ RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::create();
CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, true, CSSStrictMode, 0);
if (parsedStyle->isEmpty())
return false;
diff --git a/Source/core/css/FontLoader.idl b/Source/core/css/FontLoader.idl
index 954f383..7e7842a 100644
--- a/Source/core/css/FontLoader.idl
+++ b/Source/core/css/FontLoader.idl
@@ -33,7 +33,7 @@
EnabledAtRuntime=fontLoadEvents,
ActiveDOMObject,
EventTarget,
- GenerateIsReachable=ImplDocument,
+ GenerateIsReachable=document
] interface FontLoader {
attribute EventListener onloading;
diff --git a/Source/core/css/MediaFeatureNames.h b/Source/core/css/MediaFeatureNames.h
index 78c8f19..b249625 100644
--- a/Source/core/css/MediaFeatureNames.h
+++ b/Source/core/css/MediaFeatureNames.h
@@ -27,6 +27,7 @@
namespace MediaFeatureNames {
#define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
+ macro(deprecatedTransition, "-webkit-transition") \
macro(color, "color") \
macro(colorIndex, "color-index") \
macro(grid, "grid") \
@@ -66,7 +67,7 @@
macro(resolution, "resolution") \
macro(transform2d, "-webkit-transform-2d") \
macro(transform3d, "-webkit-transform-3d") \
- macro(transition, "-webkit-transition") \
+ macro(scan, "scan") \
macro(animation, "-webkit-animation") \
macro(viewMode, "-webkit-view-mode")
diff --git a/Source/core/css/MediaList.cpp b/Source/core/css/MediaList.cpp
index ebaa05b..d6ec554 100644
--- a/Source/core/css/MediaList.cpp
+++ b/Source/core/css/MediaList.cpp
@@ -20,7 +20,6 @@
#include "config.h"
#include "core/css/MediaList.h"
-#include "core/css/CSSImportRule.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/MediaFeatureNames.h"
@@ -28,9 +27,7 @@
#include "core/css/MediaQueryExp.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/ScriptableDocumentParser.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/page/Console.h"
#include "core/page/DOMWindow.h"
#include "wtf/MemoryInstrumentationVector.h"
#include "wtf/text/StringBuilder.h"
@@ -120,68 +117,60 @@
return string.left(i);
}
-bool MediaQuerySet::parse(const String& mediaString)
+PassOwnPtr<MediaQuery> MediaQuerySet::parseMediaQuery(const String& queryString)
{
CSSParser parser(CSSStrictMode);
+ OwnPtr<MediaQuery> parsedQuery = parser.parseMediaQuery(queryString);
+
+ if (parsedQuery)
+ return parsedQuery.release();
+
+ if (m_fallbackToDescriptor) {
+ String medium = parseMediaDescriptor(queryString);
+ if (!medium.isNull())
+ return adoptPtr(new MediaQuery(MediaQuery::None, medium, nullptr));
+ }
+
+ return adoptPtr(new MediaQuery(MediaQuery::None, "not all", nullptr));
+}
+
+bool MediaQuerySet::parse(const String& mediaString)
+{
+ if (mediaString.isEmpty()) {
+ m_queries.clear();
+ return true;
+ }
+
+ Vector<String> list;
+ // FIXME: This is too simple as it shouldn't split when the ',' is inside
+ // other allowed matching pairs such as (), [], {}, "", and ''.
+ mediaString.split(',', /* allowEmptyEntries */ true, list);
Vector<OwnPtr<MediaQuery> > result;
- Vector<String> list;
- mediaString.split(',', list);
+ result.reserveInitialCapacity(list.size());
+
for (unsigned i = 0; i < list.size(); ++i) {
- String medium = list[i].stripWhiteSpace();
- if (medium.isEmpty()) {
- if (!m_fallbackToDescriptor)
- return false;
- continue;
- }
- OwnPtr<MediaQuery> mediaQuery = parser.parseMediaQuery(medium);
- if (!mediaQuery) {
- if (!m_fallbackToDescriptor)
- return false;
- String mediaDescriptor = parseMediaDescriptor(medium);
- if (mediaDescriptor.isNull())
- continue;
- mediaQuery = adoptPtr(new MediaQuery(MediaQuery::None, mediaDescriptor, nullptr));
- }
- result.append(mediaQuery.release());
+ String queryString = list[i].stripWhiteSpace();
+ if (OwnPtr<MediaQuery> parsedQuery = parseMediaQuery(queryString))
+ result.uncheckedAppend(parsedQuery.release());
}
- // ",,,," falls straight through, but is not valid unless fallback
- if (!m_fallbackToDescriptor && list.isEmpty()) {
- String strippedMediaString = mediaString.stripWhiteSpace();
- if (!strippedMediaString.isEmpty())
- return false;
- }
+
m_queries.swap(result);
return true;
}
bool MediaQuerySet::add(const String& queryString)
{
- CSSParser parser(CSSStrictMode);
-
- OwnPtr<MediaQuery> parsedQuery = parser.parseMediaQuery(queryString);
- if (!parsedQuery && m_fallbackToDescriptor) {
- String medium = parseMediaDescriptor(queryString);
- if (!medium.isNull())
- parsedQuery = adoptPtr(new MediaQuery(MediaQuery::None, medium, nullptr));
+ if (OwnPtr<MediaQuery> parsedQuery = parseMediaQuery(queryString)) {
+ m_queries.append(parsedQuery.release());
+ return true;
}
- if (!parsedQuery)
- return false;
-
- m_queries.append(parsedQuery.release());
- return true;
+ return false;
}
bool MediaQuerySet::remove(const String& queryStringToRemove)
{
- CSSParser parser(CSSStrictMode);
-
- OwnPtr<MediaQuery> parsedQuery = parser.parseMediaQuery(queryStringToRemove);
- if (!parsedQuery && m_fallbackToDescriptor) {
- String medium = parseMediaDescriptor(queryStringToRemove);
- if (!medium.isNull())
- parsedQuery = adoptPtr(new MediaQuery(MediaQuery::None, medium, nullptr));
- }
+ OwnPtr<MediaQuery> parsedQuery = parseMediaQuery(queryStringToRemove);
if (!parsedQuery)
return false;
diff --git a/Source/core/css/MediaList.h b/Source/core/css/MediaList.h
index 93f8c1d..cc69035 100644
--- a/Source/core/css/MediaList.h
+++ b/Source/core/css/MediaList.h
@@ -74,6 +74,8 @@
MediaQuerySet(const String& mediaQuery, bool fallbackToDescription);
MediaQuerySet(const MediaQuerySet&);
+ PassOwnPtr<MediaQuery> parseMediaQuery(const String&);
+
unsigned m_fallbackToDescriptor : 1; // true if failed media query parsing should fallback to media description parsing.
signed m_lastLine : 31;
Vector<OwnPtr<MediaQuery> > m_queries;
diff --git a/Source/core/css/MediaList.idl b/Source/core/css/MediaList.idl
index 248a092..29cc41a 100644
--- a/Source/core/css/MediaList.idl
+++ b/Source/core/css/MediaList.idl
@@ -25,7 +25,6 @@
// Introduced in DOM Level 2:
[
- ImplementationLacksVTable
] interface MediaList {
[TreatNullAs=NullString, TreatReturnedNullStringAs=Null, SetterRaisesException] attribute DOMString mediaText;
diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
index d1aa3f7..97b6248 100644
--- a/Source/core/css/MediaQueryEvaluator.cpp
+++ b/Source/core/css/MediaQueryEvaluator.cpp
@@ -34,24 +34,18 @@
#include "core/css/CSSAspectRatioValue.h"
#include "core/css/CSSHelper.h"
#include "core/css/CSSPrimitiveValue.h"
-#include "core/css/CSSValueList.h"
#include "core/css/MediaFeatureNames.h"
#include "core/css/MediaList.h"
#include "core/css/MediaQuery.h"
#include "core/css/MediaQueryExp.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/NodeRenderStyle.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/DOMWindow.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
-#include "core/page/Screen.h"
#include "core/page/Settings.h"
#include "core/platform/PlatformScreen.h"
#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
#include "core/rendering/RenderLayerCompositor.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/style/RenderStyle.h"
@@ -67,14 +61,6 @@
typedef HashMap<AtomicStringImpl*, EvalFunc> FunctionMap;
static FunctionMap* gFunctionMap;
-/*
- * FIXME: following media features are not implemented: scan
- *
- * scan: The "scan" media feature describes the scanning process of
- * tv output devices. It's unknown how to retrieve this information from
- * the platform
- */
-
MediaQueryEvaluator::MediaQueryEvaluator(bool mediaFeatureResult)
: m_frame(0)
, m_style(0)
@@ -554,8 +540,10 @@
return true;
}
-static bool transitionMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
+static bool deprecatedTransitionMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
{
+ UseCounter::countDeprecation(frame->document(), UseCounter::PrefixedTransitionMediaFeature);
+
if (value) {
float number;
return numberValue(value, number) && compareValue(1, static_cast<int>(number), op);
@@ -660,6 +648,25 @@
|| (pointer == MousePointer && id == CSSValueFine);
}
+static bool scanMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix)
+{
+ // Scan only applies to tv media.
+ if (!equalIgnoringCase(frame->view()->mediaType(), "tv"))
+ return false;
+
+ if (!value)
+ return true;
+
+ if (!value->isPrimitiveValue())
+ return false;
+
+ // If a platform interface supplies progressive/interlace info for TVs in the
+ // future, it needs to be handled here. For now, assume a modern TV with
+ // progressive display.
+ const int id = toCSSPrimitiveValue(value)->getIdent();
+ return id == CSSValueProgressive;
+}
+
static void createFunctionMap()
{
// Create the table.
diff --git a/Source/core/css/MediaQueryExp.cpp b/Source/core/css/MediaQueryExp.cpp
index fdfe564..128c436 100644
--- a/Source/core/css/MediaQueryExp.cpp
+++ b/Source/core/css/MediaQueryExp.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "core/css/MediaQueryExp.h"
+#include "CSSValueKeywords.h"
#include "core/css/CSSAspectRatioValue.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSPrimitiveValue.h"
@@ -46,7 +47,36 @@
return mediaFeature == MediaFeatureNames::orientationMediaFeature
|| mediaFeature == MediaFeatureNames::viewModeMediaFeature
- || mediaFeature == MediaFeatureNames::pointerMediaFeature;
+ || mediaFeature == MediaFeatureNames::pointerMediaFeature
+ || mediaFeature == MediaFeatureNames::scanMediaFeature;
+}
+
+static inline bool featureWithValidIdent(const AtomicString& mediaFeature, int ident)
+{
+ if (mediaFeature == MediaFeatureNames::orientationMediaFeature)
+ return ident == CSSValuePortrait || ident == CSSValueLandscape;
+
+ if (mediaFeature == MediaFeatureNames::viewModeMediaFeature) {
+ switch (ident) {
+ case CSSValueWindowed:
+ case CSSValueFloating:
+ case CSSValueFullscreen:
+ case CSSValueMaximized:
+ case CSSValueMinimized:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ if (mediaFeature == MediaFeatureNames::pointerMediaFeature)
+ return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSValueFine;
+
+ if (mediaFeature == MediaFeatureNames::scanMediaFeature)
+ return ident == CSSValueInterlace || ident == CSSValueProgressive;
+
+ ASSERT_NOT_REACHED();
+ return false;
}
static inline bool featureWithValidPositiveLenghtOrNumber(const AtomicString& mediaFeature, const CSSParserValue* value)
@@ -89,6 +119,7 @@
|| mediaFeature == MediaFeatureNames::colorIndexMediaFeature
|| mediaFeature == MediaFeatureNames::maxColorIndexMediaFeature
|| mediaFeature == MediaFeatureNames::minColorIndexMediaFeature
+ || mediaFeature == MediaFeatureNames::monochromeMediaFeature
|| mediaFeature == MediaFeatureNames::minMonochromeMediaFeature
|| mediaFeature == MediaFeatureNames::maxMonochromeMediaFeature;
}
@@ -100,7 +131,7 @@
return mediaFeature == MediaFeatureNames::transform2dMediaFeature
|| mediaFeature == MediaFeatureNames::transform3dMediaFeature
- || mediaFeature == MediaFeatureNames::transitionMediaFeature
+ || mediaFeature == MediaFeatureNames::deprecatedTransitionMediaFeature
|| mediaFeature == MediaFeatureNames::animationMediaFeature
|| mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature
|| mediaFeature == MediaFeatureNames::maxDevicePixelRatioMediaFeature
@@ -143,12 +174,13 @@
|| mediaFeature == MediaFeatureNames::hoverMediaFeature
|| mediaFeature == MediaFeatureNames::transform2dMediaFeature
|| mediaFeature == MediaFeatureNames::transform3dMediaFeature
- || mediaFeature == MediaFeatureNames::transitionMediaFeature
+ || mediaFeature == MediaFeatureNames::deprecatedTransitionMediaFeature
|| mediaFeature == MediaFeatureNames::animationMediaFeature
|| mediaFeature == MediaFeatureNames::viewModeMediaFeature
|| mediaFeature == MediaFeatureNames::pointerMediaFeature
|| mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature
- || mediaFeature == MediaFeatureNames::resolutionMediaFeature;
+ || mediaFeature == MediaFeatureNames::resolutionMediaFeature
+ || mediaFeature == MediaFeatureNames::scanMediaFeature;
}
bool MediaQueryExp::isViewportDependent() const
@@ -176,8 +208,11 @@
CSSParserValue* value = valueList->current();
// Media features that use CSSValueIDs.
- if (featureWithCSSValueID(mediaFeature, value))
+ if (featureWithCSSValueID(mediaFeature, value)) {
m_value = CSSPrimitiveValue::createIdentifier(value->id);
+ if (!featureWithValidIdent(mediaFeature, toCSSPrimitiveValue(m_value.get())->getIdent()))
+ m_value.clear();
+ }
// Media features that must have non-negative <density>, ie. dppx, dpi or dpcm.
else if (featureWithValidDensity(mediaFeature, value))
diff --git a/Source/core/css/MediaQueryList.idl b/Source/core/css/MediaQueryList.idl
index b00b705..7785d8d 100644
--- a/Source/core/css/MediaQueryList.idl
+++ b/Source/core/css/MediaQueryList.idl
@@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface MediaQueryList {
readonly attribute DOMString media;
readonly attribute boolean matches;
diff --git a/Source/core/css/MediaQueryListListener.cpp b/Source/core/css/MediaQueryListListener.cpp
index 1d7c2e4..74f976c 100644
--- a/Source/core/css/MediaQueryListListener.cpp
+++ b/Source/core/css/MediaQueryListListener.cpp
@@ -22,7 +22,6 @@
#include "V8MediaQueryList.h"
#include "bindings/v8/ScriptFunctionCall.h"
-#include "core/css/MediaQueryList.h"
namespace WebCore {
diff --git a/Source/core/css/MediaQueryListListener.idl b/Source/core/css/MediaQueryListListener.idl
index 91f97f1..d8ff09e 100644
--- a/Source/core/css/MediaQueryListListener.idl
+++ b/Source/core/css/MediaQueryListListener.idl
@@ -19,7 +19,7 @@
[
- CPPPureInterface,
+ CPPPureInterface
] interface MediaQueryListListener {
void queryChanged([Default=Undefined] optional MediaQueryList list);
};
diff --git a/Source/core/css/MediaQueryMatcher.cpp b/Source/core/css/MediaQueryMatcher.cpp
index b93fcc5..094341e 100644
--- a/Source/core/css/MediaQueryMatcher.cpp
+++ b/Source/core/css/MediaQueryMatcher.cpp
@@ -26,7 +26,6 @@
#include "core/css/MediaQueryListListener.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
-#include "core/dom/Element.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
diff --git a/Source/core/css/PageRuleCollector.cpp b/Source/core/css/PageRuleCollector.cpp
index a38444b..b09d3a1 100644
--- a/Source/core/css/PageRuleCollector.cpp
+++ b/Source/core/css/PageRuleCollector.cpp
@@ -29,7 +29,6 @@
#include "config.h"
#include "core/css/PageRuleCollector.h"
-#include "core/css/CSSDefaultStyleSheets.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index 5757056..356824f 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -302,9 +302,9 @@
return cssStyleSheet ? cssStyleSheet->contents() : 0;
}
-PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const
+PassRefPtr<MutableStylePropertySet> PropertySetCSSStyleDeclaration::copyProperties() const
{
- return m_propertySet->copy();
+ return m_propertySet->mutableCopy();
}
bool PropertySetCSSStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, const CSSValue* propertyValue) const
@@ -312,7 +312,7 @@
return m_propertySet->propertyMatches(propertyID, propertyValue);
}
-StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(StylePropertySet* propertySet, CSSRule* parentRule)
+StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertySet* propertySet, CSSRule* parentRule)
: PropertySetCSSStyleDeclaration(propertySet)
, m_refCount(1)
, m_parentRule(parentRule)
@@ -358,7 +358,7 @@
return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
}
-void StyleRuleCSSStyleDeclaration::reattach(StylePropertySet* propertySet)
+void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet* propertySet)
{
ASSERT(propertySet);
m_propertySet->deref();
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.h b/Source/core/css/PropertySetCSSStyleDeclaration.h
index 1a0d9c3..ea40793 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.h
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -34,13 +34,13 @@
class CSSRule;
class CSSProperty;
class CSSValue;
-class StylePropertySet;
+class MutableStylePropertySet;
class StyleSheetContents;
class StyledElement;
class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration {
public:
- PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySet(propertySet) { }
+ PropertySetCSSStyleDeclaration(MutableStylePropertySet* propertySet) : m_propertySet(propertySet) { }
virtual StyledElement* parentElement() const { return 0; }
virtual void clearParentElement() { ASSERT_NOT_REACHED(); }
@@ -69,7 +69,7 @@
virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE;
virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRIDE;
- virtual PassRefPtr<StylePropertySet> copy() const OVERRIDE;
+ virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE;
CSSValue* cloneAndCacheForCSSOM(CSSValue*);
@@ -78,14 +78,14 @@
virtual void willMutate() { }
virtual void didMutate(MutationType) { }
- StylePropertySet* m_propertySet;
+ MutableStylePropertySet* m_propertySet;
OwnPtr<HashMap<CSSValue*, RefPtr<CSSValue> > > m_cssomCSSValueClones;
};
class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration
{
public:
- static PassRefPtr<StyleRuleCSSStyleDeclaration> create(StylePropertySet* propertySet, CSSRule* parentRule)
+ static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertySet* propertySet, CSSRule* parentRule)
{
return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule));
}
@@ -95,12 +95,12 @@
virtual void ref() OVERRIDE;
virtual void deref() OVERRIDE;
- void reattach(StylePropertySet*);
+ void reattach(MutableStylePropertySet*);
virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
private:
- StyleRuleCSSStyleDeclaration(StylePropertySet*, CSSRule*);
+ StyleRuleCSSStyleDeclaration(MutableStylePropertySet*, CSSRule*);
virtual ~StyleRuleCSSStyleDeclaration();
virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
@@ -117,7 +117,7 @@
class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration
{
public:
- InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* parentElement)
+ InlineCSSStyleDeclaration(MutableStylePropertySet* propertySet, StyledElement* parentElement)
: PropertySetCSSStyleDeclaration(propertySet)
, m_parentElement(parentElement)
{
diff --git a/Source/core/css/RGBColor.idl b/Source/core/css/RGBColor.idl
index 6afcfac..09fa76e 100644
--- a/Source/core/css/RGBColor.idl
+++ b/Source/core/css/RGBColor.idl
@@ -19,7 +19,6 @@
*/
[
- ImplementationLacksVTable
] interface RGBColor {
readonly attribute CSSPrimitiveValue red;
readonly attribute CSSPrimitiveValue green;
diff --git a/Source/core/css/Rect.idl b/Source/core/css/Rect.idl
index 5013285..3eac82f 100644
--- a/Source/core/css/Rect.idl
+++ b/Source/core/css/Rect.idl
@@ -18,7 +18,6 @@
*/
[
- ImplementationLacksVTable
] interface Rect {
readonly attribute CSSPrimitiveValue top;
readonly attribute CSSPrimitiveValue right;
diff --git a/Source/core/css/RuleSet.cpp b/Source/core/css/RuleSet.cpp
index df8500c..627e43c 100644
--- a/Source/core/css/RuleSet.cpp
+++ b/Source/core/css/RuleSet.cpp
@@ -56,6 +56,11 @@
// -----------------------------------------------------------------
+static inline bool isDocumentScope(const ContainerNode* scope)
+{
+ return !scope || scope->isDocumentNode();
+}
+
static inline bool isSelectorMatchingHTMLBasedOnRuleHash(const CSSSelector* selector)
{
ASSERT(selector);
@@ -304,7 +309,7 @@
const CSSSelectorList& selectorList = styleRule->selectorList();
for (size_t selectorIndex = 0; selectorIndex != notFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
if (selectorList.hasShadowDistributedAt(selectorIndex)) {
- if (!scope)
+ if (isDocumentScope(scope))
continue;
resolver->ruleSets().shadowDistributedRules().addRule(styleRule, selectorIndex, const_cast<ContainerNode*>(scope), addRuleFlags);
} else
@@ -319,29 +324,27 @@
} else if (rule->isFontFaceRule() && resolver) {
// Add this font face to our set.
// FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment.
- if (scope)
+ if (!isDocumentScope(scope))
continue;
const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(rule);
resolver->fontSelector()->addFontFaceRule(fontFaceRule);
resolver->invalidateMatchedPropertiesCache();
} else if (rule->isKeyframesRule() && resolver) {
// FIXME (BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment.
- if (scope)
+ if (!isDocumentScope(scope))
continue;
resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule));
}
else if (rule->isRegionRule() && resolver) {
// FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment.
- if (scope)
- continue;
addRegionRule(static_cast<StyleRuleRegion*>(rule), hasDocumentSecurityOrigin);
}
else if (rule->isHostRule())
- resolver->addHostRule(static_cast<StyleRuleHost*>(rule), hasDocumentSecurityOrigin, scope);
+ resolver->ensureScopedStyleResolver(scope->shadowHost())->addHostRule(static_cast<StyleRuleHost*>(rule), hasDocumentSecurityOrigin, scope);
#if ENABLE(CSS_DEVICE_ADAPTATION)
else if (rule->isViewportRule() && resolver) {
// @viewport should not be scoped.
- if (scope)
+ if (!isDocumentScope(scope))
continue;
resolver->viewportStyleResolver()->addViewportRule(static_cast<StyleRuleViewport*>(rule));
}
diff --git a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp
index add75ce..fd03b7c 100644
--- a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp
@@ -20,7 +20,6 @@
#include "config.h"
-#if ENABLE(SVG)
#include "core/css/CSSComputedStyleDeclaration.h"
#include "CSSPropertyNames.h"
@@ -211,7 +210,3 @@
}
}
-
-#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/Source/core/css/SVGCSSParser.cpp b/Source/core/css/SVGCSSParser.cpp
index 81b2b0a..6085823 100644
--- a/Source/core/css/SVGCSSParser.cpp
+++ b/Source/core/css/SVGCSSParser.cpp
@@ -22,11 +22,8 @@
#include "config.h"
-#if ENABLE(SVG)
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
-#include "core/css/CSSInheritedValue.h"
-#include "core/css/CSSInitialValue.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSValueList.h"
#include "core/rendering/RenderTheme.h"
@@ -290,7 +287,7 @@
case CSSPropertyMarker:
{
ShorthandScope scope(this, propId);
- m_implicitShorthand = true;
+ CSSParser::ImplicitScope implicitScope(this, PropertyImplicit);
if (!parseValue(CSSPropertyMarkerStart, important))
return false;
if (m_valueList->current()) {
@@ -300,7 +297,6 @@
CSSValue* value = m_parsedProperties.last().value();
addProperty(CSSPropertyMarkerMid, value, important);
addProperty(CSSPropertyMarkerEnd, value, important);
- m_implicitShorthand = false;
return true;
}
default:
@@ -373,5 +369,3 @@
}
}
-
-#endif // ENABLE(SVG)
diff --git a/Source/core/css/SVGCSSStyleSelector.cpp b/Source/core/css/SVGCSSStyleSelector.cpp
index 8bb0b27..ace386b 100644
--- a/Source/core/css/SVGCSSStyleSelector.cpp
+++ b/Source/core/css/SVGCSSStyleSelector.cpp
@@ -28,21 +28,17 @@
#include "config.h"
-#if ENABLE(SVG)
#include "core/css/resolver/StyleResolver.h"
#include <stdlib.h>
#include "CSSPropertyNames.h"
-#include "SVGNames.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSValueList.h"
#include "core/css/ShadowValue.h"
-#include "core/dom/Document.h"
#include "core/rendering/style/SVGRenderStyle.h"
#include "core/rendering/style/SVGRenderStyleDefs.h"
#include "core/svg/SVGColor.h"
#include "core/svg/SVGPaint.h"
-#include "core/svg/SVGStyledElement.h"
#include "core/svg/SVGURIReference.h"
#include <wtf/MathExtras.h>
@@ -613,5 +609,3 @@
}
}
-
-#endif
diff --git a/Source/core/css/SVGCSSValueKeywords.in b/Source/core/css/SVGCSSValueKeywords.in
index a578f0f..ad23956 100644
--- a/Source/core/css/SVGCSSValueKeywords.in
+++ b/Source/core/css/SVGCSSValueKeywords.in
@@ -1,6 +1,7 @@
//
// SVG CSS value names
//
+
// CSS_PROP_*_COLOR
//
aliceblue
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 0586571..cde1613 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -32,7 +32,6 @@
#include "core/css/CSSSelector.h"
#include "core/css/CSSSelectorList.h"
#include "core/css/SiblingTraversalStrategies.h"
-#include "core/dom/CustomElementRegistry.h"
#include "core/dom/Document.h"
#include "core/dom/NodeRenderStyle.h"
#include "core/dom/StyledElement.h"
@@ -44,8 +43,7 @@
#include "core/html/HTMLFrameElementBase.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLOptionElement.h"
-#include "core/html/HTMLProgressElement.h"
-#include "core/html/HTMLStyleElement.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/page/FocusController.h"
#include "core/page/Frame.h"
@@ -141,6 +139,13 @@
switch (relation) {
case CSSSelector::Descendant:
+ if (context.selector->relationIsForShadowDistributed()) {
+ for (Element* element = context.element; element; element = element->parentElement()) {
+ if (matchForShadowDistributed(element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext) == SelectorMatches)
+ return SelectorMatches;
+ }
+ return SelectorFailsCompletely;
+ }
nextContext.element = context.element->parentElement();
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
@@ -152,15 +157,15 @@
return SelectorFailsCompletely;
}
return SelectorFailsCompletely;
-
case CSSSelector::Child:
+ if (context.selector->relationIsForShadowDistributed())
+ return matchForShadowDistributed(context.element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext);
nextContext.element = context.element->parentElement();
if (!nextContext.element)
return SelectorFailsCompletely;
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
-
case CSSSelector::DirectAdjacent:
if (m_mode == ResolvingStyle) {
if (Element* parentElement = context.element->parentElement())
@@ -201,7 +206,7 @@
nextContext.isSubSelector = true;
return match(nextContext, dynamicPseudo, siblingTraversalStrategy);
- case CSSSelector::ShadowDescendant:
+ case CSSSelector::ShadowPseudo:
{
// If we're in the same tree-scope as the scoping element, then following a shadow descendant combinator would escape that and thus the scope.
if (context.scope && context.scope->treeScope() == context.element->treeScope() && (context.behaviorAtBoundary & BoundaryBehaviorMask) != StaysWithinTreeScope)
@@ -214,28 +219,35 @@
nextContext.elementStyle = 0;
return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
}
- case CSSSelector::ShadowDistributed:
- {
- Vector<InsertionPoint*, 8> insertionPoints;
- for (Element* element = context.element; element; element = element->parentElement()) {
- insertionPoints.clear();
- collectInsertionPointsWhereNodeIsDistributed(element, insertionPoints);
- for (size_t i = 0; i < insertionPoints.size(); ++i) {
- nextContext.element = insertionPoints[i];
- nextContext.isSubSelector = false;
- nextContext.elementStyle = 0;
- if (match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
- return SelectorMatches;
- }
- }
- return SelectorFailsCompletely;
- }
}
ASSERT_NOT_REACHED();
return SelectorFailsCompletely;
}
+template<typename SiblingTraversalStrategy>
+SelectorChecker::Match SelectorChecker::matchForShadowDistributed(const Element* element, const SiblingTraversalStrategy& siblingTraversalStrategy, PseudoId& dynamicPseudo, SelectorCheckingContext& nextContext) const
+{
+ Vector<InsertionPoint*, 8> insertionPoints;
+ collectInsertionPointsWhereNodeIsDistributed(element, insertionPoints);
+ for (size_t i = 0; i < insertionPoints.size(); ++i) {
+ nextContext.element = insertionPoints[i];
+ nextContext.isSubSelector = false;
+ nextContext.elementStyle = 0;
+ if (match(nextContext, dynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
+ return SelectorMatches;
+ }
+ return SelectorFailsCompletely;
+}
+
+static inline bool containsHTMLSpace(const AtomicString& string)
+{
+ for (unsigned i = 0; i < string.length(); i++)
+ if (isHTMLSpace(string[i]))
+ return true;
+ return false;
+}
+
static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::Match match, const AtomicString& selectorValue, bool caseSensitive)
{
const AtomicString& value = attributeItem->value();
@@ -249,8 +261,8 @@
break;
case CSSSelector::List:
{
- // Ignore empty selectors or selectors containing spaces
- if (selectorValue.contains(' ') || selectorValue.isEmpty())
+ // Ignore empty selectors or selectors containing HTML spaces
+ if (containsHTMLSpace(selectorValue) || selectorValue.isEmpty())
return false;
unsigned startSearchAt = 0;
@@ -258,9 +270,9 @@
size_t foundPos = value.find(selectorValue, startSearchAt, caseSensitive);
if (foundPos == notFound)
return false;
- if (!foundPos || value[foundPos - 1] == ' ') {
+ if (!foundPos || isHTMLSpace(value[foundPos - 1])) {
unsigned endStr = foundPos + selectorValue.length();
- if (endStr == value.length() || value[endStr] == ' ')
+ if (endStr == value.length() || isHTMLSpace(value[endStr]))
break; // We found a match.
}
diff --git a/Source/core/css/SelectorChecker.h b/Source/core/css/SelectorChecker.h
index 5869a35..2b192e7 100644
--- a/Source/core/css/SelectorChecker.h
+++ b/Source/core/css/SelectorChecker.h
@@ -89,6 +89,10 @@
template<typename SiblingTraversalStrategy>
Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversalStrategy&) const;
+
+ template<typename SiblingTraversalStrategy>
+ Match matchForShadowDistributed(const Element*, const SiblingTraversalStrategy&, PseudoId&, SelectorCheckingContext& nextContext) const;
+
template<typename SiblingTraversalStrategy>
bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy&) const;
diff --git a/Source/core/css/SelectorFilter.cpp b/Source/core/css/SelectorFilter.cpp
index e813ebe..632a7ec 100644
--- a/Source/core/css/SelectorFilter.cpp
+++ b/Source/core/css/SelectorFilter.cpp
@@ -135,6 +135,7 @@
unsigned* hash = identifierHashes;
unsigned* end = identifierHashes + maximumIdentifierCount;
CSSSelector::Relation relation = selector->relation();
+ bool relationIsForShadowDistributed = selector->relationIsForShadowDistributed();
// Skip the topmost selector. It is handled quickly by the rule hashes.
bool skipOverSubselectors = true;
@@ -147,12 +148,15 @@
break;
case CSSSelector::DirectAdjacent:
case CSSSelector::IndirectAdjacent:
- case CSSSelector::ShadowDescendant:
- case CSSSelector::ShadowDistributed:
+ case CSSSelector::ShadowPseudo:
skipOverSubselectors = true;
break;
case CSSSelector::Descendant:
case CSSSelector::Child:
+ if (relationIsForShadowDistributed) {
+ skipOverSubselectors = true;
+ break;
+ }
skipOverSubselectors = false;
collectDescendantSelectorIdentifierHashes(selector, hash);
break;
@@ -160,9 +164,9 @@
if (hash == end)
return;
relation = selector->relation();
+ relationIsForShadowDistributed = selector->relationIsForShadowDistributed();
}
*hash = 0;
}
}
-
diff --git a/Source/core/css/StyleInvalidationAnalysis.cpp b/Source/core/css/StyleInvalidationAnalysis.cpp
index c3ec7ea..b0ef035 100644
--- a/Source/core/css/StyleInvalidationAnalysis.cpp
+++ b/Source/core/css/StyleInvalidationAnalysis.cpp
@@ -32,7 +32,6 @@
#include "core/dom/ContainerNode.h"
#include "core/dom/Document.h"
#include "core/dom/NodeTraversal.h"
-#include "core/dom/StyledElement.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/HTMLStyleElement.h"
diff --git a/Source/core/css/StyleMedia.idl b/Source/core/css/StyleMedia.idl
index fb447e7..27424f3 100644
--- a/Source/core/css/StyleMedia.idl
+++ b/Source/core/css/StyleMedia.idl
@@ -25,7 +25,7 @@
*/
[
- NoInterfaceObject,
+ NoInterfaceObject
] interface StyleMedia {
readonly attribute DOMString type;
boolean matchMedium([Default=Undefined] optional DOMString mediaquery);
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index fb15f98..0450b7d 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -201,11 +201,6 @@
case CSSPropertyWebkitTransitionDelay:
shorthandPropertyID = CSSPropertyWebkitTransition;
break;
- case CSSPropertyWebkitWrapFlow:
- case CSSPropertyWebkitShapeMargin:
- case CSSPropertyWebkitShapePadding:
- shorthandPropertyID = CSSPropertyWebkitWrap;
- break;
default:
break;
}
@@ -381,16 +376,12 @@
return getLayeredShorthandValue(webkitTransitionShorthand());
case CSSPropertyWebkitAnimation:
return getLayeredShorthandValue(webkitAnimationShorthand());
- case CSSPropertyWebkitWrap:
- return getShorthandValue(webkitWrapShorthand());
-#if ENABLE(SVG)
case CSSPropertyMarker: {
RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyMarkerStart);
if (value)
return value->cssText();
return String();
}
-#endif
case CSSPropertyBorderRadius:
return get4Values(borderRadiusShorthand());
default:
@@ -598,6 +589,11 @@
else
yValue = nextValue;
+ // background-repeat-x(y) or mask-repeat-x(y) may be like this : "initial, repeat". We can omit the implicit initial values
+ // before starting to compare their values.
+ if (value->isImplicitInitialValue() || yValue->isImplicitInitialValue())
+ continue;
+
int xId = toCSSPrimitiveValue(value.get())->getIdent();
int yId = toCSSPrimitiveValue(yValue.get())->getIdent();
if (xId != yId) {
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
index 1c7c414..e95154c 100644
--- a/Source/core/css/StylePropertySet.cpp
+++ b/Source/core/css/StylePropertySet.cpp
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2011 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@ -22,16 +22,13 @@
#include "config.h"
#include "core/css/StylePropertySet.h"
-#include "CSSValueKeywords.h"
#include "core/css/CSSParser.h"
-#include "core/css/CSSValueList.h"
#include "core/css/CSSValuePool.h"
#include "core/css/CSSVariableValue.h"
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "core/css/StylePropertySerializer.h"
#include "core/css/StylePropertyShorthand.h"
#include "core/css/StyleSheetContents.h"
-#include "core/dom/Document.h"
#include "core/page/RuntimeCSSEnabled.h"
#include <wtf/BitArray.h>
#include <wtf/MemoryInstrumentationVector.h>
@@ -47,7 +44,7 @@
namespace WebCore {
-typedef HashMap<const StylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap;
+typedef HashMap<MutableStylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap;
static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap()
{
DEFINE_STATIC_LOCAL(PropertySetCSSOMWrapperMap, propertySetCSSOMWrapperMapInstance, ());
@@ -59,17 +56,18 @@
return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count;
}
-PassRefPtr<StylePropertySet> StylePropertySet::createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
+PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
{
void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCount(count));
return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssParserMode));
}
-PassRefPtr<StylePropertySet> StylePropertySet::immutableCopyIfNeeded() const
+PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() const
{
if (!isMutable())
- return const_cast<StylePropertySet*>(this);
- return createImmutable(mutablePropertyVector().data(), mutablePropertyVector().size(), cssParserMode());
+ return static_cast<ImmutableStylePropertySet*>(const_cast<StylePropertySet*>(this));
+ const MutableStylePropertySet* mutableThis = static_cast<const MutableStylePropertySet*>(this);
+ return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(), mutableThis->m_propertyVector.size(), cssParserMode());
}
MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length)
@@ -83,8 +81,8 @@
ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properties, unsigned length, CSSParserMode cssParserMode)
: StylePropertySet(cssParserMode, length)
{
- StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(immutableMetadataArray());
- CSSValue** valueArray = const_cast<CSSValue**>(immutableValueArray());
+ StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(this->metadataArray());
+ CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
for (unsigned i = 0; i < length; ++i) {
metadataArray[i] = properties[i].metadata();
valueArray[i] = properties[i].value();
@@ -94,7 +92,7 @@
ImmutableStylePropertySet::~ImmutableStylePropertySet()
{
- CSSValue** valueArray = const_cast<CSSValue**>(immutableValueArray());
+ CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
for (unsigned i = 0; i < m_arraySize; ++i)
valueArray[i]->deref();
}
@@ -103,7 +101,7 @@
: StylePropertySet(other.cssParserMode())
{
if (other.isMutable())
- m_propertyVector = static_cast<const MutableStylePropertySet&>(other).mutablePropertyVector();
+ m_propertyVector = static_cast<const MutableStylePropertySet&>(other).m_propertyVector;
else {
m_propertyVector.reserveInitialCapacity(other.propertyCount());
for (unsigned i = 0; i < other.propertyCount(); ++i)
@@ -111,7 +109,7 @@
}
}
-StylePropertySet::~StylePropertySet()
+MutableStylePropertySet::~MutableStylePropertySet()
{
ASSERT(!m_ownsCSSOMWrapper || propertySetCSSOMWrapperMap().contains(this));
if (m_ownsCSSOMWrapper)
@@ -135,9 +133,8 @@
return propertyAt(foundPropertyIndex).value();
}
-bool StylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
+bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
{
- ASSERT(isMutable());
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
if (!shorthand.length())
return false;
@@ -152,9 +149,8 @@
return removePropertiesInSet(shorthandPrefixingVariant.properties(), shorthandPrefixingVariant.length());
}
-bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText)
+bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText)
{
- ASSERT(isMutable());
if (removeShorthandProperty(propertyID)) {
// FIXME: Return an equivalent shorthand when possible.
if (returnText)
@@ -174,19 +170,19 @@
// A more efficient removal strategy would involve marking entries as empty
// and sweeping them when the vector grows too big.
- mutablePropertyVector().remove(foundPropertyIndex);
+ m_propertyVector.remove(foundPropertyIndex);
removePrefixedOrUnprefixedProperty(propertyID);
return true;
}
-void StylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID propertyID)
+void MutableStylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID propertyID)
{
int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(propertyID));
if (foundPropertyIndex == -1)
return;
- mutablePropertyVector().remove(foundPropertyIndex);
+ m_propertyVector.remove(foundPropertyIndex);
}
bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const
@@ -222,9 +218,8 @@
return propertyAt(foundPropertyIndex).isImplicit();
}
-bool StylePropertySet::setProperty(CSSPropertyID propertyID, const String& value, bool important, StyleSheetContents* contextStyleSheet)
+bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const String& value, bool important, StyleSheetContents* contextStyleSheet)
{
- ASSERT(isMutable());
// Setting the value to an empty string just removes the property in both IE and Gecko.
// Setting it to null seems to produce less consistent results, but we treat it just the same.
if (value.isEmpty())
@@ -235,9 +230,8 @@
return CSSParser::parseValue(this, propertyID, value, important, cssParserMode(), contextStyleSheet);
}
-void StylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> prpValue, bool important)
+void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> prpValue, bool important)
{
- ASSERT(isMutable());
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
if (!shorthand.length()) {
setProperty(CSSProperty(propertyID, prpValue, important));
@@ -248,14 +242,13 @@
RefPtr<CSSValue> value = prpValue;
for (unsigned i = 0; i < shorthand.length(); ++i)
- mutablePropertyVector().append(CSSProperty(shorthand.properties()[i], value, important));
+ m_propertyVector.append(CSSProperty(shorthand.properties()[i], value, important));
}
-void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot)
+void MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot)
{
- ASSERT(isMutable());
if (!removeShorthandProperty(property.id())) {
- CSSProperty* toReplace = slot ? slot : findMutableCSSPropertyWithID(property.id());
+ CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id());
if (toReplace) {
*toReplace = property;
setPrefixingVariantProperty(property);
@@ -265,56 +258,52 @@
appendPrefixingVariantProperty(property);
}
-void StylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
+void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
{
- mutablePropertyVector().append(property);
+ m_propertyVector.append(property);
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
if (prefixingVariant == property.id())
return;
- mutablePropertyVector().append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit));
+ m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit));
}
-void StylePropertySet::setPrefixingVariantProperty(const CSSProperty& property)
+void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& property)
{
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
- CSSProperty* toReplace = findMutableCSSPropertyWithID(prefixingVariant);
+ CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
if (toReplace)
*toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit);
}
-bool StylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, bool important)
+bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, bool important)
{
- ASSERT(isMutable());
setProperty(CSSProperty(propertyID, cssValuePool().createIdentifierValue(identifier), important));
return true;
}
-void StylePropertySet::parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet)
+void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet)
{
- ASSERT(isMutable());
-
- mutablePropertyVector().clear();
+ m_propertyVector.clear();
CSSParserContext context(cssParserMode());
if (contextStyleSheet) {
context = contextStyleSheet->parserContext();
context.mode = cssParserMode();
}
- CSSParser parser(context);
+
+ CSSParser parser(context, UseCounter::getFrom(contextStyleSheet));
parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet);
}
-void StylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties)
+void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty>& properties)
{
- ASSERT(isMutable());
- mutablePropertyVector().reserveCapacity(mutablePropertyVector().size() + properties.size());
+ m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size());
for (unsigned i = 0; i < properties.size(); ++i)
addParsedProperty(properties[i]);
}
-void StylePropertySet::addParsedProperty(const CSSProperty& property)
+void MutableStylePropertySet::addParsedProperty(const CSSProperty& property)
{
- ASSERT(isMutable());
// Only add properties that have no !important counterpart present
if (!propertyIsImportant(property.id()) || property.isImportant())
setProperty(property);
@@ -325,13 +314,13 @@
return StylePropertySerializer(*this).asText();
}
-void StylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other)
+void MutableStylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other)
{
ASSERT(isMutable());
unsigned size = other->propertyCount();
for (unsigned n = 0; n < size; ++n) {
PropertyReference toMerge = other->propertyAt(n);
- CSSProperty* old = findMutableCSSPropertyWithID(toMerge.id());
+ CSSProperty* old = findCSSPropertyWithID(toMerge.id());
if (old)
setProperty(toMerge.toCSSProperty(), old);
else
@@ -393,26 +382,24 @@
return properties;
}
-void StylePropertySet::clear()
+void MutableStylePropertySet::clear()
{
- ASSERT(isMutable());
- mutablePropertyVector().clear();
+ m_propertyVector.clear();
}
-PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const
+PassRefPtr<MutableStylePropertySet> StylePropertySet::copyBlockProperties() const
{
return copyPropertiesInSet(blockProperties());
}
-void StylePropertySet::removeBlockProperties()
+void MutableStylePropertySet::removeBlockProperties()
{
removePropertiesInSet(blockProperties().data(), blockProperties().size());
}
-bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned length)
+bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned length)
{
- ASSERT(isMutable());
- if (mutablePropertyVector().isEmpty())
+ if (m_propertyVector.isEmpty())
return false;
// FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless.
@@ -421,11 +408,11 @@
toRemove.add(set[i]);
Vector<CSSProperty> newProperties;
- newProperties.reserveInitialCapacity(mutablePropertyVector().size());
+ newProperties.reserveInitialCapacity(m_propertyVector.size());
- unsigned size = mutablePropertyVector().size();
+ unsigned size = m_propertyVector.size();
for (unsigned n = 0; n < size; ++n) {
- const CSSProperty& property = mutablePropertyVector().at(n);
+ const CSSProperty& property = m_propertyVector.at(n);
// Not quite sure if the isImportant test is needed but it matches the existing behavior.
if (!property.isImportant()) {
if (toRemove.contains(property.id()))
@@ -434,8 +421,8 @@
newProperties.append(property);
}
- bool changed = newProperties.size() != mutablePropertyVector().size();
- mutablePropertyVector() = newProperties;
+ bool changed = newProperties.size() != m_propertyVector.size();
+ m_propertyVector = newProperties;
return changed;
}
@@ -451,15 +438,14 @@
return -1;
}
-CSSProperty* StylePropertySet::findMutableCSSPropertyWithID(CSSPropertyID propertyID)
+CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID propertyID)
{
- ASSERT(isMutable());
int foundPropertyIndex = findPropertyIndex(propertyID);
if (foundPropertyIndex == -1)
return 0;
- return &mutablePropertyVector().at(foundPropertyIndex);
+ return &m_propertyVector.at(foundPropertyIndex);
}
-
+
bool StylePropertySet::propertyMatches(CSSPropertyID propertyID, const CSSValue* propertyValue) const
{
int foundPropertyIndex = findPropertyIndex(propertyID);
@@ -468,11 +454,10 @@
return propertyAt(foundPropertyIndex).value()->equals(*propertyValue);
}
-void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style)
+void MutableStylePropertySet::removeEquivalentProperties(const StylePropertySet* style)
{
- ASSERT(isMutable());
Vector<CSSPropertyID> propertiesToRemove;
- unsigned size = mutablePropertyVector().size();
+ unsigned size = m_propertyVector.size();
for (unsigned i = 0; i < size; ++i) {
PropertyReference property = propertyAt(i);
if (style->propertyMatches(property.id(), property.value()))
@@ -483,11 +468,10 @@
removeProperty(propertiesToRemove[i]);
}
-void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style)
+void MutableStylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style)
{
- ASSERT(isMutable());
Vector<CSSPropertyID> propertiesToRemove;
- unsigned size = mutablePropertyVector().size();
+ unsigned size = m_propertyVector.size();
for (unsigned i = 0; i < size; ++i) {
PropertyReference property = propertyAt(i);
if (style->cssPropertyMatches(property.id(), property.value()))
@@ -498,12 +482,12 @@
removeProperty(propertiesToRemove[i]);
}
-PassRefPtr<StylePropertySet> StylePropertySet::copy() const
+PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
{
return adoptRef(new MutableStylePropertySet(*this));
}
-PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
+PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
{
Vector<CSSProperty, 256> list;
list.reserveInitialCapacity(properties.size());
@@ -512,42 +496,37 @@
if (value)
list.append(CSSProperty(properties[i], value.release(), false));
}
- return StylePropertySet::create(list.data(), list.size());
+ return MutableStylePropertySet::create(list.data(), list.size());
}
-PropertySetCSSStyleDeclaration* StylePropertySet::cssStyleDeclaration()
+PropertySetCSSStyleDeclaration* MutableStylePropertySet::cssStyleDeclaration()
{
if (!m_ownsCSSOMWrapper)
return 0;
- ASSERT(isMutable());
return propertySetCSSOMWrapperMap().get(this);
}
-CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration()
+CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration()
{
- ASSERT(isMutable());
-
if (m_ownsCSSOMWrapper) {
ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().get(this))->parentRule());
ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement());
return propertySetCSSOMWrapperMap().get(this);
}
m_ownsCSSOMWrapper = true;
- PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclaration(const_cast<StylePropertySet*>(this));
+ PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclaration(this);
propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
return cssomWrapper;
}
-CSSStyleDeclaration* StylePropertySet::ensureInlineCSSStyleDeclaration(const StyledElement* parentElement)
+CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(StyledElement* parentElement)
{
- ASSERT(isMutable());
-
if (m_ownsCSSOMWrapper) {
ASSERT(propertySetCSSOMWrapperMap().get(this)->parentElement() == parentElement);
return propertySetCSSOMWrapperMap().get(this);
}
m_ownsCSSOMWrapper = true;
- PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StylePropertySet*>(this), const_cast<StyledElement*>(parentElement));
+ PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(this, parentElement);
propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
return cssomWrapper;
}
@@ -563,7 +542,7 @@
size_t actualSize = m_isMutable ? sizeof(StylePropertySet) : sizeForImmutableStylePropertySetWithPropertyCount(m_arraySize);
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS, actualSize);
if (m_isMutable)
- info.addMember(mutablePropertyVector(), "mutablePropertyVector()");
+ info.addMember(static_cast<const MutableStylePropertySet*>(this)->m_propertyVector, "m_propertyVector");
else {
for (unsigned i = 0; i < propertyCount(); ++i)
info.addMember(propertyAt(i).value(), "value");
@@ -583,12 +562,12 @@
}
#endif
-PassRefPtr<StylePropertySet> StylePropertySet::create(CSSParserMode cssParserMode)
+PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMode cssParserMode)
{
return adoptRef(new MutableStylePropertySet(cssParserMode));
}
-PassRefPtr<StylePropertySet> StylePropertySet::create(const CSSProperty* properties, unsigned count)
+PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSProperty* properties, unsigned count)
{
return adoptRef(new MutableStylePropertySet(properties, count));
}
diff --git a/Source/core/css/StylePropertySet.h b/Source/core/css/StylePropertySet.h
index e75744a..067b5aa 100644
--- a/Source/core/css/StylePropertySet.h
+++ b/Source/core/css/StylePropertySet.h
@@ -44,16 +44,10 @@
class StylePropertySet : public RefCounted<StylePropertySet> {
friend class PropertyReference;
public:
- ~StylePropertySet();
-
// Override RefCounted's deref() to ensure operator delete is called on
// the appropriate subclass type.
void deref();
- static PassRefPtr<StylePropertySet> create(CSSParserMode = CSSQuirksMode);
- static PassRefPtr<StylePropertySet> create(const CSSProperty* properties, unsigned count);
- static PassRefPtr<StylePropertySet> createImmutable(const CSSProperty* properties, unsigned count, CSSParserMode);
-
class PropertyReference {
public:
PropertyReference(const StylePropertySet& propertySet, unsigned index)
@@ -80,19 +74,8 @@
CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(), const_cast<CSSValue*>(propertyValue())); }
private:
- StylePropertyMetadata propertyMetadata() const
- {
- if (m_propertySet.isMutable())
- return m_propertySet.mutablePropertyVector().at(m_index).metadata();
- return m_propertySet.immutableMetadataArray()[m_index];
- }
-
- const CSSValue* propertyValue() const
- {
- if (m_propertySet.isMutable())
- return m_propertySet.mutablePropertyVector().at(m_index).value();
- return m_propertySet.immutableValueArray()[m_index];
- }
+ StylePropertyMetadata propertyMetadata() const;
+ const CSSValue* propertyValue() const;
const StylePropertySet& m_propertySet;
unsigned m_index;
@@ -109,49 +92,19 @@
CSSPropertyID getPropertyShorthand(CSSPropertyID) const;
bool isPropertyImplicit(CSSPropertyID) const;
- // These expand shorthand properties into multiple properties.
- bool setProperty(CSSPropertyID, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
- void setProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important = false);
-
- // These do not. FIXME: This is too messy, we can do better.
- bool setProperty(CSSPropertyID, int identifier, bool important = false);
- void appendPrefixingVariantProperty(const CSSProperty&);
- void setPrefixingVariantProperty(const CSSProperty&);
- void setProperty(const CSSProperty&, CSSProperty* slot = 0);
-
- bool removeProperty(CSSPropertyID, String* returnText = 0);
- void removePrefixedOrUnprefixedProperty(CSSPropertyID);
-
- void parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet);
-
- void addParsedProperties(const Vector<CSSProperty>&);
- void addParsedProperty(const CSSProperty&);
-
- void clear();
- PassRefPtr<StylePropertySet> copyBlockProperties() const;
- void removeBlockProperties();
- bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
-
- void mergeAndOverrideOnConflict(const StylePropertySet*);
+ PassRefPtr<MutableStylePropertySet> copyBlockProperties() const;
CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* contextStyleSheet) const;
- PassRefPtr<StylePropertySet> copy() const;
- PassRefPtr<StylePropertySet> immutableCopyIfNeeded() const;
+ PassRefPtr<MutableStylePropertySet> mutableCopy() const;
+ PassRefPtr<ImmutableStylePropertySet> immutableCopyIfNeeded() const;
- void removeEquivalentProperties(const StylePropertySet*);
- void removeEquivalentProperties(const CSSStyleDeclaration*);
-
- PassRefPtr<StylePropertySet> copyPropertiesInSet(const Vector<CSSPropertyID>&) const;
+ PassRefPtr<MutableStylePropertySet> copyPropertiesInSet(const Vector<CSSPropertyID>&) const;
String asText() const;
- PropertySetCSSStyleDeclaration* cssStyleDeclaration();
- CSSStyleDeclaration* ensureCSSStyleDeclaration();
- CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement);
-
bool isMutable() const { return m_isMutable; }
bool hasCSSOMWrapper() const { return m_ownsCSSOMWrapper; }
@@ -164,8 +117,7 @@
void showStyle();
#endif
- const CSSValue** immutableValueArray() const;
- const StylePropertyMetadata* immutableMetadataArray() const;
+ bool propertyMatches(CSSPropertyID, const CSSValue*) const;
protected:
StylePropertySet(CSSParserMode cssParserMode)
@@ -182,19 +134,10 @@
, m_arraySize(immutableArraySize)
{ }
- Vector<CSSProperty, 4>& mutablePropertyVector();
- const Vector<CSSProperty, 4>& mutablePropertyVector() const;
-
unsigned m_cssParserMode : 2;
mutable unsigned m_ownsCSSOMWrapper : 1;
mutable unsigned m_isMutable : 1;
unsigned m_arraySize : 28;
-
-private:
- bool removeShorthandProperty(CSSPropertyID);
- bool propertyMatches(CSSPropertyID, const CSSValue*) const;
-
- CSSProperty* findMutableCSSPropertyWithID(CSSPropertyID);
friend class PropertySetCSSStyleDeclaration;
};
@@ -205,51 +148,101 @@
// tweak.
NEW_DELETE_SAME_AS_MALLOC_FREE;
public:
- ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode);
~ImmutableStylePropertySet();
+ static PassRefPtr<ImmutableStylePropertySet> create(const CSSProperty* properties, unsigned count, CSSParserMode);
+
+ unsigned propertyCount() const { return m_arraySize; }
+
+ const CSSValue** valueArray() const;
+ const StylePropertyMetadata* metadataArray() const;
void* m_storage;
+
+private:
+ ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode);
};
-inline const CSSValue** StylePropertySet::immutableValueArray() const
+inline const CSSValue** ImmutableStylePropertySet::valueArray() const
{
- ASSERT(!m_isMutable);
return reinterpret_cast<const CSSValue**>(const_cast<const void**>((&static_cast<const ImmutableStylePropertySet*>(this)->m_storage)));
}
-inline const StylePropertyMetadata* StylePropertySet::immutableMetadataArray() const
+inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() const
{
- ASSERT(!m_isMutable);
return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<const char*>((&static_cast<const ImmutableStylePropertySet*>(this)->m_storage))[m_arraySize * sizeof(CSSValue*)]);
}
class MutableStylePropertySet : public StylePropertySet {
public:
+ ~MutableStylePropertySet();
+
+ static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksMode);
+ static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* properties, unsigned count);
+
+ MutableStylePropertySet(const StylePropertySet&);
+
+ unsigned propertyCount() const { return m_propertyVector.size(); }
+ PropertySetCSSStyleDeclaration* cssStyleDeclaration();
+
+ void addParsedProperties(const Vector<CSSProperty>&);
+ void addParsedProperty(const CSSProperty&);
+
+ // These expand shorthand properties into multiple properties.
+ bool setProperty(CSSPropertyID, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
+ void setProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important = false);
+
+ // These do not. FIXME: This is too messy, we can do better.
+ bool setProperty(CSSPropertyID, int identifier, bool important = false);
+ void appendPrefixingVariantProperty(const CSSProperty&);
+ void setPrefixingVariantProperty(const CSSProperty&);
+ void setProperty(const CSSProperty&, CSSProperty* slot = 0);
+
+ bool removeProperty(CSSPropertyID, String* returnText = 0);
+ void removePrefixedOrUnprefixedProperty(CSSPropertyID);
+ void removeBlockProperties();
+ bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
+ void removeEquivalentProperties(const StylePropertySet*);
+ void removeEquivalentProperties(const CSSStyleDeclaration*);
+
+ void mergeAndOverrideOnConflict(const StylePropertySet*);
+
+ void clear();
+ void parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet);
+
+ CSSStyleDeclaration* ensureCSSStyleDeclaration();
+ CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(StyledElement* parentElement);
+
+ Vector<CSSProperty, 4> m_propertyVector;
+
+private:
MutableStylePropertySet(CSSParserMode cssParserMode)
: StylePropertySet(cssParserMode)
{ }
- MutableStylePropertySet(const CSSProperty* properties, unsigned count);
- MutableStylePropertySet(const StylePropertySet&);
- Vector<CSSProperty, 4> m_propertyVector;
+ MutableStylePropertySet(const CSSProperty* properties, unsigned count);
+
+ bool removeShorthandProperty(CSSPropertyID);
+ CSSProperty* findCSSPropertyWithID(CSSPropertyID);
};
-inline Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector()
+inline StylePropertyMetadata StylePropertySet::PropertyReference::propertyMetadata() const
{
- ASSERT(m_isMutable);
- return static_cast<MutableStylePropertySet*>(this)->m_propertyVector;
+ if (m_propertySet.isMutable())
+ return static_cast<const MutableStylePropertySet&>(m_propertySet).m_propertyVector.at(m_index).metadata();
+ return static_cast<const ImmutableStylePropertySet&>(m_propertySet).metadataArray()[m_index];
}
-inline const Vector<CSSProperty, 4>& StylePropertySet::mutablePropertyVector() const
+inline const CSSValue* StylePropertySet::PropertyReference::propertyValue() const
{
- ASSERT(m_isMutable);
- return static_cast<const MutableStylePropertySet*>(this)->m_propertyVector;
+ if (m_propertySet.isMutable())
+ return static_cast<const MutableStylePropertySet&>(m_propertySet).m_propertyVector.at(m_index).value();
+ return static_cast<const ImmutableStylePropertySet&>(m_propertySet).valueArray()[m_index];
}
inline unsigned StylePropertySet::propertyCount() const
{
if (m_isMutable)
- return mutablePropertyVector().size();
+ return static_cast<const MutableStylePropertySet*>(this)->m_propertyVector.size();
return m_arraySize;
}
diff --git a/Source/core/css/StylePropertyShorthand.cpp b/Source/core/css/StylePropertyShorthand.cpp
index 4b40224..89ffe35 100644
--- a/Source/core/css/StylePropertyShorthand.cpp
+++ b/Source/core/css/StylePropertyShorthand.cpp
@@ -470,17 +470,6 @@
return webkitTransformOriginLonghands;
}
-const StylePropertyShorthand& webkitWrapShorthand()
-{
- static const CSSPropertyID webkitWrapProperties[] = {
- CSSPropertyWebkitWrapFlow,
- CSSPropertyWebkitShapeMargin,
- CSSPropertyWebkitShapePadding
- };
- DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitWrapLonghands, (webkitWrapProperties, WTF_ARRAY_LENGTH(webkitWrapProperties)));
- return webkitWrapLonghands;
-}
-
// Returns an empty list if the property is not a shorthand
const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID)
{
@@ -569,8 +558,6 @@
return webkitTransitionShorthand();
case CSSPropertyWebkitTransformOrigin:
return webkitTransformOriginShorthand();
- case CSSPropertyWebkitWrap:
- return webkitWrapShorthand();
default: {
DEFINE_STATIC_LOCAL(StylePropertyShorthand, emptyShorthand, ());
return emptyShorthand;
diff --git a/Source/core/css/StylePropertyShorthand.h b/Source/core/css/StylePropertyShorthand.h
index 91c0f41..2ae9356 100644
--- a/Source/core/css/StylePropertyShorthand.h
+++ b/Source/core/css/StylePropertyShorthand.h
@@ -102,7 +102,6 @@
const StylePropertyShorthand& webkitTextStrokeShorthand();
const StylePropertyShorthand& webkitTransitionShorthand();
const StylePropertyShorthand& webkitTransformOriginShorthand();
-const StylePropertyShorthand& webkitWrapShorthand();
// Returns an empty list if the property is not a shorthand
const StylePropertyShorthand& shorthandForProperty(CSSPropertyID);
diff --git a/Source/core/css/StyleRule.cpp b/Source/core/css/StyleRule.cpp
index 5ffe9ef..41cda8c 100644
--- a/Source/core/css/StyleRule.cpp
+++ b/Source/core/css/StyleRule.cpp
@@ -261,7 +261,7 @@
StyleRule::StyleRule(const StyleRule& o)
: StyleRuleBase(o)
- , m_properties(o.m_properties->copy())
+ , m_properties(o.m_properties->mutableCopy())
, m_selectorList(o.m_selectorList)
{
}
@@ -270,11 +270,11 @@
{
}
-StylePropertySet* StyleRule::mutableProperties()
+MutableStylePropertySet* StyleRule::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleRule::setProperties(PassRefPtr<StylePropertySet> properties)
@@ -289,7 +289,7 @@
StyleRulePage::StyleRulePage(const StyleRulePage& o)
: StyleRuleBase(o)
- , m_properties(o.m_properties->copy())
+ , m_properties(o.m_properties->mutableCopy())
, m_selectorList(o.m_selectorList)
{
}
@@ -298,11 +298,11 @@
{
}
-StylePropertySet* StyleRulePage::mutableProperties()
+MutableStylePropertySet* StyleRulePage::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleRulePage::setProperties(PassRefPtr<StylePropertySet> properties)
@@ -324,7 +324,7 @@
StyleRuleFontFace::StyleRuleFontFace(const StyleRuleFontFace& o)
: StyleRuleBase(o)
- , m_properties(o.m_properties->copy())
+ , m_properties(o.m_properties->mutableCopy())
{
}
@@ -332,11 +332,11 @@
{
}
-StylePropertySet* StyleRuleFontFace::mutableProperties()
+MutableStylePropertySet* StyleRuleFontFace::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleRuleFontFace::setProperties(PassRefPtr<StylePropertySet> properties)
@@ -443,7 +443,7 @@
StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o)
: StyleRuleBase(o)
- , m_properties(o.m_properties->copy())
+ , m_properties(o.m_properties->mutableCopy())
{
}
@@ -451,11 +451,11 @@
{
}
-StylePropertySet* StyleRuleViewport::mutableProperties()
+MutableStylePropertySet* StyleRuleViewport::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleRuleViewport::setProperties(PassRefPtr<StylePropertySet> properties)
@@ -479,7 +479,7 @@
StyleRuleFilter::StyleRuleFilter(const StyleRuleFilter& o)
: StyleRuleBase(o)
, m_filterName(o.m_filterName)
- , m_properties(o.m_properties->copy())
+ , m_properties(o.m_properties->mutableCopy())
{
}
@@ -487,11 +487,11 @@
{
}
-StylePropertySet* StyleRuleFilter::mutableProperties()
+MutableStylePropertySet* StyleRuleFilter::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleRuleFilter::setProperties(PassRefPtr<StylePropertySet> properties)
diff --git a/Source/core/css/StyleRule.h b/Source/core/css/StyleRule.h
index ba4d893..1ac9a80 100644
--- a/Source/core/css/StyleRule.h
+++ b/Source/core/css/StyleRule.h
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
* (C) 2002-2003 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2002, 2006, 2008, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2002, 2006, 2008, 2012, 2013 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
@@ -31,6 +31,7 @@
class CSSRule;
class CSSStyleRule;
class CSSStyleSheet;
+class MutableStylePropertySet;
class StylePropertySet;
class StyleRuleBase : public WTF::RefCountedBase {
@@ -112,7 +113,7 @@
const CSSSelectorList& selectorList() const { return m_selectorList; }
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
@@ -144,7 +145,7 @@
~StyleRuleFontFace();
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void setProperties(PassRefPtr<StylePropertySet>);
@@ -167,7 +168,7 @@
const CSSSelector* selector() const { return m_selectorList.first(); }
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
@@ -283,7 +284,7 @@
~StyleRuleViewport();
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void setProperties(PassRefPtr<StylePropertySet>);
@@ -326,7 +327,7 @@
const String& filterName() const { return m_filterName; }
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void setProperties(PassRefPtr<StylePropertySet>);
diff --git a/Source/core/css/StyleRuleImport.cpp b/Source/core/css/StyleRuleImport.cpp
index ebefb93..8f77583 100644
--- a/Source/core/css/StyleRuleImport.cpp
+++ b/Source/core/css/StyleRuleImport.cpp
@@ -23,14 +23,12 @@
#include "core/css/StyleRuleImport.h"
#include <wtf/StdLibExtras.h>
-#include "core/css/CSSStyleSheet.h"
#include "core/css/StyleSheetContents.h"
#include "core/dom/Document.h"
#include "core/loader/cache/CachedCSSStyleSheet.h"
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
#include "core/loader/cache/CachedResourceRequestInitiators.h"
-#include "weborigin/SecurityOrigin.h"
namespace WebCore {
@@ -117,8 +115,7 @@
rootSheet = sheet;
}
- CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset());
- request.setInitiator(cachedResourceRequestInitiators().css);
+ CachedResourceRequest request(ResourceRequest(absURL), cachedResourceRequestInitiators().css, m_parentStyleSheet->charset());
if (m_parentStyleSheet->isUserStyleSheet())
m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request);
else
diff --git a/Source/core/css/StyleSheet.idl b/Source/core/css/StyleSheet.idl
index 842174a..2c179ac 100644
--- a/Source/core/css/StyleSheet.idl
+++ b/Source/core/css/StyleSheet.idl
@@ -21,7 +21,7 @@
// Introduced in DOM Level 2:
[
CustomToV8,
- GenerateIsReachable=ImplOwnerNodeRoot
+ GenerateIsReachable=ownerNode
] interface StyleSheet {
[TreatReturnedNullStringAs=Null] readonly attribute DOMString type;
attribute boolean disabled;
diff --git a/Source/core/css/StyleSheetContents.cpp b/Source/core/css/StyleSheetContents.cpp
index e8ab818..6324aac 100644
--- a/Source/core/css/StyleSheetContents.cpp
+++ b/Source/core/css/StyleSheetContents.cpp
@@ -24,14 +24,12 @@
#include <wtf/Deque.h>
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/MemoryInstrumentationVector.h>
-#include "core/css/CSSImportRule.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/MediaList.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleRuleImport.h"
-#include "core/dom/Document.h"
#include "core/dom/Node.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/loader/cache/CachedCSSStyleSheet.h"
@@ -280,7 +278,7 @@
bool hasValidMIMEType = false;
String sheetText = cachedStyleSheet->sheetText(enforceMIMEType, &hasValidMIMEType);
- CSSParser p(parserContext());
+ CSSParser p(parserContext(), UseCounter::getFrom(this));
p.parseSheet(this, sheetText, 0, 0, true);
// If we're loading a stylesheet cross-origin, and the MIME type is not standard, require the CSS
@@ -311,7 +309,7 @@
bool StyleSheetContents::parseStringAtLine(const String& sheetText, int startLineNumber, bool createdByParser)
{
- CSSParser p(parserContext());
+ CSSParser p(parserContext(), UseCounter::getFrom(this));
p.parseSheet(this, sheetText, startLineNumber, 0, createdByParser);
return true;
diff --git a/Source/core/css/StyleSheetList.cpp b/Source/core/css/StyleSheetList.cpp
index 6715b33..4b040e3 100644
--- a/Source/core/css/StyleSheetList.cpp
+++ b/Source/core/css/StyleSheetList.cpp
@@ -22,7 +22,6 @@
#include "core/css/StyleSheetList.h"
#include "HTMLNames.h"
-#include "core/css/CSSStyleSheet.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentStyleSheetCollection.h"
#include "core/html/HTMLStyleElement.h"
diff --git a/Source/core/css/StyleSheetList.idl b/Source/core/css/StyleSheetList.idl
index fce41cf..b4681ab 100644
--- a/Source/core/css/StyleSheetList.idl
+++ b/Source/core/css/StyleSheetList.idl
@@ -20,11 +20,10 @@
// Introduced in DOM Level 2:
[
- GenerateIsReachable=ImplDocument,
- CustomNamedGetter,
- ImplementationLacksVTable
+ GenerateIsReachable=document,
] interface StyleSheetList {
readonly attribute unsigned long length;
getter StyleSheet item([Default=Undefined] optional unsigned long index);
+ [Custom] getter StyleSheet (DOMString name);
};
diff --git a/Source/core/css/WebKitCSSFilterValue.idl b/Source/core/css/WebKitCSSFilterValue.idl
index 2547661..4f5e23c 100644
--- a/Source/core/css/WebKitCSSFilterValue.idl
+++ b/Source/core/css/WebKitCSSFilterValue.idl
@@ -24,8 +24,7 @@
*/
[
- DoNotCheckConstants,
- ImplementationLacksVTable
+ DoNotCheckConstants
] interface WebKitCSSFilterValue : CSSValueList {
// OperationTypes
@@ -44,4 +43,5 @@
const unsigned short CSS_FILTER_CUSTOM = 12;
readonly attribute unsigned short operationType;
+ [ImplementedAs=item] getter CSSValue([Default=Undefined] optional unsigned long index);
};
diff --git a/Source/core/css/WebKitCSSKeyframeRule.cpp b/Source/core/css/WebKitCSSKeyframeRule.cpp
index 0e53f35..289caf6 100644
--- a/Source/core/css/WebKitCSSKeyframeRule.cpp
+++ b/Source/core/css/WebKitCSSKeyframeRule.cpp
@@ -41,11 +41,11 @@
{
}
-StylePropertySet* StyleKeyframe::mutableProperties()
+MutableStylePropertySet* StyleKeyframe::mutableProperties()
{
if (!m_properties->isMutable())
- m_properties = m_properties->copy();
- return m_properties.get();
+ m_properties = m_properties->mutableCopy();
+ return static_cast<MutableStylePropertySet*>(m_properties.get());
}
void StyleKeyframe::setProperties(PassRefPtr<StylePropertySet> properties)
diff --git a/Source/core/css/WebKitCSSKeyframeRule.h b/Source/core/css/WebKitCSSKeyframeRule.h
index 43ef5f5..e34821e 100644
--- a/Source/core/css/WebKitCSSKeyframeRule.h
+++ b/Source/core/css/WebKitCSSKeyframeRule.h
@@ -31,6 +31,7 @@
namespace WebCore {
class CSSStyleDeclaration;
+class MutableStylePropertySet;
class StylePropertySet;
class StyleRuleCSSStyleDeclaration;
class WebKitCSSKeyframesRule;
@@ -50,7 +51,7 @@
void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); }
const StylePropertySet* properties() const { return m_properties.get(); }
- StylePropertySet* mutableProperties();
+ MutableStylePropertySet* mutableProperties();
void setProperties(PassRefPtr<StylePropertySet>);
String cssText() const;
diff --git a/Source/core/css/WebKitCSSKeyframesRule.cpp b/Source/core/css/WebKitCSSKeyframesRule.cpp
index fc45877..36d8002 100644
--- a/Source/core/css/WebKitCSSKeyframesRule.cpp
+++ b/Source/core/css/WebKitCSSKeyframesRule.cpp
@@ -29,8 +29,6 @@
#include "core/css/CSSParser.h"
#include "core/css/CSSRuleList.h"
#include "core/css/CSSStyleSheet.h"
-#include "core/css/StylePropertySet.h"
-#include "core/css/StyleSheet.h"
#include "core/css/WebKitCSSKeyframeRule.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
@@ -122,8 +120,8 @@
{
ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());
- CSSParser parser(parserContext());
CSSStyleSheet* styleSheet = parentStyleSheet();
+ CSSParser parser(parserContext(), UseCounter::getFrom(styleSheet));
RefPtr<StyleKeyframe> keyframe = parser.parseKeyframeRule(styleSheet ? styleSheet->contents() : 0, ruleText);
if (!keyframe)
return;
diff --git a/Source/core/css/WebKitCSSMatrix.cpp b/Source/core/css/WebKitCSSMatrix.cpp
index 4948e9e..9efebb5 100644
--- a/Source/core/css/WebKitCSSMatrix.cpp
+++ b/Source/core/css/WebKitCSSMatrix.cpp
@@ -30,7 +30,6 @@
#include "CSSValueKeywords.h"
#include "core/css/CSSParser.h"
#include "core/css/StylePropertySet.h"
-#include "core/css/resolver/StyleResolver.h"
#include "core/css/resolver/TransformBuilder.h"
#include "core/dom/ExceptionCode.h"
#include <wtf/MathExtras.h>
@@ -58,7 +57,7 @@
if (string.isEmpty())
return;
- RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create();
+ RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::create();
if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, CSSStrictMode, 0)) {
// Convert to TransformOperations. This can fail if a property
// requires style (i.e., param uses 'ems' or 'exs')
diff --git a/Source/core/css/WebKitCSSMixFunctionValue.idl b/Source/core/css/WebKitCSSMixFunctionValue.idl
index 1ce921e..c4a2abd 100644
--- a/Source/core/css/WebKitCSSMixFunctionValue.idl
+++ b/Source/core/css/WebKitCSSMixFunctionValue.idl
@@ -28,7 +28,6 @@
*/
[
- ImplementationLacksVTable
] interface WebKitCSSMixFunctionValue : CSSValueList {
};
diff --git a/Source/core/css/WebKitCSSRegionRule.idl b/Source/core/css/WebKitCSSRegionRule.idl
index 7549b75..2dfbf39 100644
--- a/Source/core/css/WebKitCSSRegionRule.idl
+++ b/Source/core/css/WebKitCSSRegionRule.idl
@@ -28,7 +28,7 @@
*/
[
- EnabledAtRuntime=cssRegions,
+ EnabledAtRuntime=cssRegions
] interface WebKitCSSRegionRule : CSSRule {
readonly attribute CSSRuleList cssRules;
};
diff --git a/Source/core/css/WebKitCSSSVGDocumentValue.cpp b/Source/core/css/WebKitCSSSVGDocumentValue.cpp
index 46b6203..a7afd99 100644
--- a/Source/core/css/WebKitCSSSVGDocumentValue.cpp
+++ b/Source/core/css/WebKitCSSSVGDocumentValue.cpp
@@ -24,16 +24,15 @@
#include "config.h"
-#if ENABLE(SVG)
#include "core/css/WebKitCSSSVGDocumentValue.h"
#include "core/css/CSSParser.h"
#include "core/dom/Document.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/loader/cache/CachedDocument.h"
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
#include "core/loader/cache/CachedResourceRequestInitiators.h"
-#include "core/loader/cache/CachedSVGDocument.h"
namespace WebCore {
@@ -48,15 +47,14 @@
{
}
-CachedSVGDocument* WebKitCSSSVGDocumentValue::load(CachedResourceLoader* loader)
+CachedDocument* WebKitCSSSVGDocumentValue::load(CachedResourceLoader* loader)
{
ASSERT(loader);
if (!m_loadRequested) {
m_loadRequested = true;
- CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)));
- request.setInitiator(cachedResourceRequestInitiators().css);
+ CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), cachedResourceRequestInitiators().css);
m_document = loader->requestSVGDocument(request);
}
@@ -81,5 +79,3 @@
}
} // namespace WebCore
-
-#endif // ENABLE(SVG)
diff --git a/Source/core/css/WebKitCSSSVGDocumentValue.h b/Source/core/css/WebKitCSSSVGDocumentValue.h
index 26c5584..c6af8c6 100644
--- a/Source/core/css/WebKitCSSSVGDocumentValue.h
+++ b/Source/core/css/WebKitCSSSVGDocumentValue.h
@@ -26,8 +26,8 @@
#define WebKitCSSSVGDocumentValue_h
#include "core/css/CSSValue.h"
+#include "core/loader/cache/CachedDocument.h"
#include "core/loader/cache/CachedResourceHandle.h"
-#include "core/loader/cache/CachedSVGDocument.h"
namespace WebCore {
@@ -38,8 +38,8 @@
static PassRefPtr<WebKitCSSSVGDocumentValue> create(const String& url) { return adoptRef(new WebKitCSSSVGDocumentValue(url)); }
~WebKitCSSSVGDocumentValue();
- CachedSVGDocument* cachedSVGDocument() const { return m_document.get(); }
- CachedSVGDocument* load(CachedResourceLoader*);
+ CachedDocument* cachedSVGDocument() const { return m_document.get(); }
+ CachedDocument* load(CachedResourceLoader*);
String customCssText() const;
const String& url() const { return m_url; }
@@ -52,7 +52,7 @@
WebKitCSSSVGDocumentValue(const String& url);
String m_url;
- CachedResourceHandle<CachedSVGDocument> m_document;
+ CachedResourceHandle<CachedDocument> m_document;
bool m_loadRequested;
};
diff --git a/Source/core/css/WebKitCSSShaderValue.cpp b/Source/core/css/WebKitCSSShaderValue.cpp
index 53903bf..23b49d0 100644
--- a/Source/core/css/WebKitCSSShaderValue.cpp
+++ b/Source/core/css/WebKitCSSShaderValue.cpp
@@ -37,7 +37,6 @@
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
#include "core/loader/cache/CachedResourceRequestInitiators.h"
-#include "core/platform/KURL.h"
#include "core/rendering/style/StyleCachedShader.h"
#include "core/rendering/style/StylePendingShader.h"
@@ -66,8 +65,7 @@
if (!m_accessedShader) {
m_accessedShader = true;
- CachedResourceRequest request(ResourceRequest(completeURL(loader)));
- request.setInitiator(cachedResourceRequestInitiators().css);
+ CachedResourceRequest request(ResourceRequest(completeURL(loader)), cachedResourceRequestInitiators().css);
if (CachedResourceHandle<CachedShader> cachedShader = loader->requestShader(request))
m_shader = StyleCachedShader::create(cachedShader.get());
}
diff --git a/Source/core/css/WebKitCSSTransformValue.cpp b/Source/core/css/WebKitCSSTransformValue.cpp
index c996001..6719d9e 100644
--- a/Source/core/css/WebKitCSSTransformValue.cpp
+++ b/Source/core/css/WebKitCSSTransformValue.cpp
@@ -63,7 +63,7 @@
{
if (operation != WebKitCSSTransformValue::UnknownTransformOperation) {
ASSERT_WITH_SECURITY_IMPLICATION(static_cast<size_t>(operation) < WTF_ARRAY_LENGTH(transformNamePrefixes));
- return makeString(transformNamePrefixes[operation], value, ')');
+ return transformNamePrefixes[operation] + value + ")";
}
return String();
}
diff --git a/Source/core/css/WebKitCSSTransformValue.idl b/Source/core/css/WebKitCSSTransformValue.idl
index ddbb799..97a5430 100644
--- a/Source/core/css/WebKitCSSTransformValue.idl
+++ b/Source/core/css/WebKitCSSTransformValue.idl
@@ -27,8 +27,7 @@
*/
[
- DoNotCheckConstants,
- ImplementationLacksVTable
+ DoNotCheckConstants
] interface WebKitCSSTransformValue : CSSValueList {
// OperationTypes
@@ -56,5 +55,6 @@
const unsigned short CSS_MATRIX3D = 21;
readonly attribute unsigned short operationType;
+ [ImplementedAs=item] getter CSSValue([Default=Undefined] optional unsigned long index);
};
diff --git a/Source/core/css/WebKitCSSViewportRule.idl b/Source/core/css/WebKitCSSViewportRule.idl
index a194922..f2cc09f 100644
--- a/Source/core/css/WebKitCSSViewportRule.idl
+++ b/Source/core/css/WebKitCSSViewportRule.idl
@@ -28,7 +28,7 @@
*/
[
- Conditional=CSS_DEVICE_ADAPTATION,
+ Conditional=CSS_DEVICE_ADAPTATION
] interface WebKitCSSViewportRule : CSSRule {
readonly attribute CSSStyleDeclaration style;
};
diff --git a/Source/core/css/html.css b/Source/core/css/html.css
index 65edad7..acf0657 100644
--- a/Source/core/css/html.css
+++ b/Source/core/css/html.css
@@ -144,17 +144,6 @@
display: inline
}
-dialog:not([open]) { display: none; }
-dialog {
- position: absolute;
- left: 0; right: 0;
- margin: auto;
- border: solid;
- padding: 1em;
- background: white;
- color: black;
-}
-
/* heading elements */
h1 {
@@ -481,12 +470,6 @@
margin: auto 0;
}
-#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT
-datalist {
- display: none;
-}
-#endif
-
#if defined(ENABLE_INPUT_MULTIPLE_FIELDS_UI) && ENABLE_INPUT_MULTIPLE_FIELDS_UI
input[type="date"] {
-webkit-align-items: center;
@@ -870,25 +853,6 @@
-webkit-user-modify: read-only !important;
}
-#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT
-
-input[type="color"][list] {
- -webkit-appearance: menulist;
- width: 88px;
- height: 23px;
-}
-
-input[type="color"][list]::-webkit-color-swatch-wrapper {
- padding-left: 8px;
- padding-right: 24px;
-}
-
-input[type="color"][list]::-webkit-color-swatch {
- border-color: #000000;
-}
-
-#endif // defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT
-
#endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR
#if defined(ENABLE_CALENDAR_PICKER) && ENABLE_CALENDAR_PICKER
diff --git a/Source/core/css/makevalues.pl b/Source/core/css/makevalues.pl
deleted file mode 100644
index 20da3b0..0000000
--- a/Source/core/css/makevalues.pl
+++ /dev/null
@@ -1,164 +0,0 @@
-#! /usr/bin/perl
-#
-# This file is part of the WebKit project
-#
-# Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
-# Copyright (C) 2007, 2012 Apple Inc. All rights reserved.
-# Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-use Getopt::Long;
-use preprocessor;
-use strict;
-use warnings;
-
-my $defines;
-my $preprocessor;
-GetOptions('defines=s' => \$defines,
- 'preprocessor=s' => \$preprocessor);
-
-my @NAMES = applyPreprocessor("CSSValueKeywords.in", $defines, $preprocessor);
-
-my %namesHash;
-my @duplicates = ();
-
-my @names = ();
-foreach (@NAMES) {
- next if (m/(^\s*$)/);
- next if (/^#/);
-
- # Input may use a different EOL sequence than $/, so avoid chomp.
- $_ =~ s/[\r\n]+$//g;
- # CSS values need to be lower case.
- $_ = lc $_;
- if (exists $namesHash{$_}) {
- push @duplicates, $_;
- } else {
- $namesHash{$_} = 1;
- }
- push @names, $_;
-}
-
-if (@duplicates > 0) {
- die 'Duplicate CSS value keywords values: ', join(', ', @duplicates) . "\n";
-}
-
-open GPERF, ">CSSValueKeywords.gperf" || die "Could not open CSSValueKeywords.gperf for writing";
-print GPERF << "EOF";
-%{
-/* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */
-
-#include \"CSSValueKeywords.h\"
-#include \"core/platform/HashTools.h\"
-#include <string.h>
-
-namespace WebCore {
-%}
-%struct-type
-struct Value;
-%omit-struct-type
-%language=C++
-%readonly-tables
-%compare-strncmp
-%define class-name CSSValueKeywordsHash
-%define lookup-function-name findValueImpl
-%define hash-function-name value_hash_function
-%define word-array-name value_word_list
-%enum
-%%
-EOF
-
-foreach my $name (@names) {
- my $id = $name;
- $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge;
- print GPERF $name . ", CSSValue" . $id . "\n";
-}
-
-print GPERF << "EOF";
-%%
-static const char* const valueList[] = {
- "",
-EOF
-
-foreach my $name (@names) {
- print GPERF " \"" . $name . "\",\n";
-}
-
-print GPERF << "EOF";
- 0
-};
-
-const Value* findValue(register const char* str, register unsigned int len)
-{
- return CSSValueKeywordsHash::findValueImpl(str, len);
-}
-
-const char* getValueName(unsigned short id)
-{
- if (id >= numCSSValueKeywords || id <= 0)
- return 0;
- return valueList[id];
-}
-
-} // namespace WebCore
-EOF
-close GPERF;
-
-
-open HEADER, ">CSSValueKeywords.h" || die "Could not open CSSValueKeywords.h for writing";
-print HEADER << "EOF";
-/* This file is automatically generated from CSSValueKeywords.in by makevalues, do not edit */
-
-#ifndef CSSValueKeywords_h
-#define CSSValueKeywords_h
-
-#include <string.h>
-
-namespace WebCore {
-
-enum CSSValueID {
- CSSValueInvalid = 0,
-EOF
-
-my $i = 1;
-my $maxLen = 0;
-foreach my $name (@names) {
- my $id = $name;
- $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge;
- print HEADER " CSSValue" . $id . " = " . $i . ",\n";
- $i = $i + 1;
- if (length($name) > $maxLen) {
- $maxLen = length($name);
- }
-}
-
-print HEADER "};\n\n";
-print HEADER "const int numCSSValueKeywords = " . $i . ";\n";
-print HEADER "const size_t maxCSSValueKeywordLength = " . $maxLen . ";\n";
-print HEADER << "EOF";
-
-const char* getValueName(unsigned short id);
-
-} // namespace WebCore
-
-#endif // CSSValueKeywords_h
-
-EOF
-close HEADER;
-
-my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf";
-system("\"$gperf\" --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf --output-file=CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?";
diff --git a/Source/core/css/resolver/FilterOperationResolver.cpp b/Source/core/css/resolver/FilterOperationResolver.cpp
index 45b8c7e..9cdd4e4 100644
--- a/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -46,10 +46,7 @@
#include "core/rendering/style/StyleCustomFilterProgram.h"
#include "core/rendering/style/StyleCustomFilterProgramCache.h"
#include "core/rendering/style/StyleShader.h"
-
-#if ENABLE(SVG)
#include "core/svg/SVGURIReference.h"
-#endif
namespace WebCore {
@@ -244,7 +241,7 @@
KURL fragmentShaderURL = fragmentShader ? fragmentShader->completeURL(cachedResourceLoader) : KURL();
RefPtr<StyleCustomFilterProgram> program;
if (customFilterProgramCache)
- program = customFilterProgramCache->lookup(CustomFilterProgramInfo(vertexShaderURL, fragmentShaderURL, programType, mixSettings, meshType));
+ program = customFilterProgramCache->lookup(CustomFilterProgramInfo(vertexShaderURL.string(), fragmentShaderURL.string(), programType, mixSettings, meshType));
if (!program) {
// Create a new StyleCustomFilterProgram that will be resolved during the loadPendingShaders and added to the cache.
program = StyleCustomFilterProgram::create(vertexShaderURL, vertexShader ? styleShader(vertexShader, state) : 0,
@@ -405,7 +402,6 @@
continue;
}
if (operationType == FilterOperation::REFERENCE) {
-#if ENABLE(SVG)
if (filterValue->length() != 1)
continue;
CSSValue* argument = filterValue->itemWithoutBoundsCheck(0);
@@ -424,7 +420,6 @@
operation->setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(svgDocumentValue->cachedSVGDocument())));
}
operations.operations().append(operation);
-#endif
continue;
}
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index 7dddf9f..9c17d55 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -28,11 +28,13 @@
#include "core/css/resolver/ScopedStyleResolver.h"
#include "HTMLNames.h"
-#include "core/css/CSSStyleRule.h"
#include "core/css/CSSStyleSheet.h"
+#include "core/css/ElementRuleCollector.h"
+#include "core/css/PageRuleCollector.h"
#include "core/css/RuleFeature.h"
#include "core/css/RuleSet.h"
-#include "core/dom/ContextFeatures.h"
+#include "core/css/StyleRule.h"
+#include "core/dom/Document.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/dom/shadow/ContentDistributor.h"
#include "core/dom/shadow/ElementShadow.h"
@@ -40,18 +42,161 @@
#include "core/html/HTMLStyleElement.h"
#include "wtf/MemoryInstrumentationHashMap.h"
#include "wtf/MemoryInstrumentationHashSet.h"
-#include "wtf/MemoryInstrumentationVector.h"
namespace WebCore {
-ScopedStyleResolver::ScopedStyleResolver()
- : m_stackParent(0)
- , m_stackParentBoundsIndex(0)
+ScopedStyleResolver* ScopedStyleTree::ensureScopedStyleResolver(const ContainerNode* scope)
{
+ ASSERT(scope);
+ bool isNewEntry;
+ ScopedStyleResolver* scopeStyleResolver = addScopedStyleResolver(scope, isNewEntry);
+ if (isNewEntry)
+ setupScopeStylesTree(scopeStyleResolver);
+ return scopeStyleResolver;
}
-ScopedStyleResolver::~ScopedStyleResolver()
+ScopedStyleResolver* ScopedStyleTree::scopedStyleResolverFor(const ContainerNode* scope)
{
+ if (!scope->hasScopedHTMLStyleChild()
+ && !(scope->isElementNode() && toElement(scope)->shadow())
+ && !scope->isDocumentNode()
+ && !scope->isShadowRoot())
+ return 0;
+ HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::iterator it = m_authorStyles.find(scope);
+ return it != m_authorStyles.end() ? it->value.get() : 0;
+}
+
+ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(const ContainerNode* scope, bool& isNewEntry)
+{
+ HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addResult = m_authorStyles.add(scope, nullptr);
+
+ if (addResult.isNewEntry) {
+ addResult.iterator->value = ScopedStyleResolver::create(scope);
+ if (!scope || scope->isDocumentNode())
+ m_scopeResolverForDocument = addResult.iterator->value.get();
+ }
+ isNewEntry = addResult.isNewEntry;
+ return addResult.iterator->value.get();
+}
+
+void ScopedStyleTree::setupScopeStylesTree(ScopedStyleResolver* target)
+{
+ ASSERT(target);
+ ASSERT(target->scope());
+
+ // Since StyleResolver creates RuleSets according to styles' document
+ // order, a parent of the given ScopedRuleData has been already
+ // prepared.
+ const ContainerNode* e = target->scope()->parentOrShadowHostNode();
+ for (; e; e = e->parentOrShadowHostNode()) {
+ if (ScopedStyleResolver* scopeResolver = scopedStyleResolverFor(e)) {
+ target->setParent(scopeResolver);
+ break;
+ }
+ if (e->isShadowRoot() || e->isDocumentNode()) {
+ bool dummy;
+ ScopedStyleResolver* scopeResolver = addScopedStyleResolver(e, dummy);
+ target->setParent(scopeResolver);
+ setupScopeStylesTree(scopeResolver);
+ break;
+ }
+ }
+}
+
+void ScopedStyleTree::clear()
+{
+ m_authorStyles.clear();
+ m_scopeResolverForDocument = 0;
+ m_cache.clear();
+}
+
+void ScopedStyleTree::resolveScopeStyles(const Element* element, Vector<std::pair<ScopedStyleResolver*, bool>, 8>& resolvers)
+{
+ ScopedStyleResolver* scopeResolver = scopedResolverFor(element);
+ if (!scopeResolver)
+ return;
+
+ bool applyAuthorStylesOfElementTreeScope = element->treeScope()->applyAuthorStyles();
+ bool applyAuthorStyles = m_cache.authorStyleBoundsIndex == m_cache.scopeResolverBoundsIndex ? applyAuthorStylesOfElementTreeScope : false;
+
+ for ( ; scopeResolver; scopeResolver = scopeResolver->parent()) {
+ resolvers.append(std::pair<ScopedStyleResolver*, bool>(scopeResolver, applyAuthorStyles));
+ if (scopeResolver->scope()->isShadowRoot()) {
+ if (scopeResolver->parent()->scope()->isInShadowTree())
+ applyAuthorStyles = applyAuthorStyles && toShadowRoot(scopeResolver->scope())->applyAuthorStyles();
+ else
+ applyAuthorStyles = applyAuthorStylesOfElementTreeScope;
+ }
+ }
+}
+
+inline ScopedStyleResolver* ScopedStyleTree::enclosingScopedStyleResolverFor(const ContainerNode* scope, int& authorStyleBoundsIndex)
+{
+ for (; scope; scope = scope->parentOrShadowHostNode()) {
+ if (ScopedStyleResolver* scopeStyleResolver = scopedStyleResolverFor(scope))
+ return scopeStyleResolver;
+ if (scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles())
+ --authorStyleBoundsIndex;
+ }
+ return 0;
+}
+
+void ScopedStyleTree::resolveStyleCache(const ContainerNode* scope)
+{
+ int authorStyleBoundsIndex = 0;
+ m_cache.scopeResolver = enclosingScopedStyleResolverFor(scope, authorStyleBoundsIndex);
+ m_cache.scopeResolverBoundsIndex = authorStyleBoundsIndex;
+ m_cache.nodeForScopeStyles = scope;
+ m_cache.authorStyleBoundsIndex = 0;
+}
+
+void ScopedStyleTree::pushStyleCache(const ContainerNode* scope, const ContainerNode* parent)
+{
+ if (m_authorStyles.isEmpty())
+ return;
+
+ if (!cacheIsValid(parent)) {
+ resolveStyleCache(scope);
+ return;
+ }
+
+ if (scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles())
+ ++m_cache.authorStyleBoundsIndex;
+
+ ScopedStyleResolver* scopeResolver = scopedStyleResolverFor(scope);
+ if (scopeResolver) {
+ m_cache.scopeResolver = scopeResolver;
+ m_cache.scopeResolverBoundsIndex = m_cache.authorStyleBoundsIndex;
+ }
+ m_cache.nodeForScopeStyles = scope;
+}
+
+void ScopedStyleTree::popStyleCache(const ContainerNode* scope)
+{
+ if (cacheIsValid(scope)) {
+ bool needUpdateBoundsIndex = scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles();
+
+ if (m_cache.scopeResolver && m_cache.scopeResolver->scope() == scope) {
+ m_cache.scopeResolver = m_cache.scopeResolver->parent();
+ if (needUpdateBoundsIndex)
+ --m_cache.scopeResolverBoundsIndex;
+ }
+ if (needUpdateBoundsIndex)
+ --m_cache.authorStyleBoundsIndex;
+ m_cache.nodeForScopeStyles = scope->parentOrShadowHostNode();
+ }
+}
+
+void ScopedStyleTree::collectFeaturesTo(RuleFeatureSet& features)
+{
+ for (HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::iterator it = m_authorStyles.begin(); it != m_authorStyles.end(); ++it)
+ it->value->collectFeaturesTo(features);
+}
+
+void ScopedStyleTree::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+ info.addMember(m_authorStyles, "authorStyles");
}
const ContainerNode* ScopedStyleResolver::scopeFor(const CSSStyleSheet* sheet)
@@ -76,104 +221,24 @@
return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0;
}
-inline RuleSet* ScopedStyleResolver::ruleSetFor(const ContainerNode* scope) const
+void ScopedStyleResolver::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
{
- if (!scope->hasScopedHTMLStyleChild())
- return 0;
- ScopedRuleSetMap::const_iterator it = m_authorStyles.find(scope);
- return it != m_authorStyles.end() ? it->value.get() : 0;
-}
-
-RuleSet* ScopedStyleResolver::ensureRuleSetFor(const ContainerNode* scope)
-{
- ScopedRuleSetMap::AddResult addResult = m_authorStyles.add(scope, nullptr);
- if (addResult.isNewEntry)
- addResult.iterator->value = RuleSet::create();
- return addResult.iterator->value.get();
-}
-
-void ScopedStyleResolver::setupStack(const ContainerNode* parent)
-{
- // The scoping element stack shouldn't be used if <style scoped> isn't used anywhere.
- ASSERT(!m_authorStyles.isEmpty());
-
- m_stack.shrink(0);
- int authorStyleBoundsIndex = 0;
- for (const ContainerNode* scope = parent; scope; scope = scope->parentOrShadowHostNode()) {
- RuleSet* ruleSet = ruleSetFor(scope);
- if (ruleSet)
- m_stack.append(StackFrame(scope, authorStyleBoundsIndex, ruleSet));
- if (scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles())
- --authorStyleBoundsIndex;
- }
-
- m_stack.reverse();
- m_stackParent = parent;
- m_stackParentBoundsIndex = 0;
-}
-
-void ScopedStyleResolver::push(const ContainerNode* scope, const ContainerNode* scopeParent)
-{
- // Shortcut: Don't bother with the scoping element stack if <style scoped> isn't used anywhere.
- if (m_authorStyles.isEmpty()) {
- ASSERT(!m_stackParent);
- ASSERT(m_stack.isEmpty());
- return;
- }
-
- // In some wacky cases during style resolve we may get invoked for random elements.
- // Recreate the whole scoping element stack in such cases.
- if (!stackIsConsistent(scopeParent)) {
- setupStack(scope);
- return;
- }
-
- if (scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles())
- ++m_stackParentBoundsIndex;
- // Otherwise just push the parent onto the stack.
- RuleSet* ruleSet = ruleSetFor(scope);
- if (ruleSet)
- m_stack.append(StackFrame(scope, m_stackParentBoundsIndex, ruleSet));
- m_stackParent = scope;
-}
-
-void ScopedStyleResolver::pop(const ContainerNode* scope)
-{
- // Only bother to update the scoping element stack if it is consistent.
- if (stackIsConsistent(scope)) {
- if (!m_stack.isEmpty() && m_stack.last().m_scope == scope)
- m_stack.removeLast();
- if (scope->isShadowRoot() && !toShadowRoot(scope)->applyAuthorStyles())
- --m_stackParentBoundsIndex;
- m_stackParent = scope->parentOrShadowHostNode();
- }
-}
-
-void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features)
-{
- for (ScopedRuleSetMap::iterator it = m_authorStyles.begin(); it != m_authorStyles.end(); ++it)
- features.add(it->value->features());
- for (ScopedRuleSetMap::iterator it = m_atHostRules.begin(); it != m_atHostRules.end(); ++it)
- features.add(it->value->features());
+ if (!m_authorStyle)
+ m_authorStyle = RuleSet::create();
+ m_authorStyle->addRulesFromSheet(sheet, medium, resolver, m_scope);
}
inline RuleSet* ScopedStyleResolver::ensureAtHostRuleSetFor(const ShadowRoot* shadowRoot)
{
- ScopedRuleSetMap::AddResult addResult = m_atHostRules.add(shadowRoot, nullptr);
+ HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::AddResult addResult = m_atHostRules.add(shadowRoot, nullptr);
if (addResult.isNewEntry)
addResult.iterator->value = RuleSet::create();
return addResult.iterator->value.get();
}
-inline RuleSet* ScopedStyleResolver::atHostRuleSetFor(const ShadowRoot* shadowRoot) const
-{
- ScopedRuleSetMap::const_iterator it = m_atHostRules.find(shadowRoot);
- return it != m_atHostRules.end() ? it->value.get() : 0;
-}
-
void ScopedStyleResolver::addHostRule(StyleRuleHost* hostRule, bool hasDocumentSecurityOrigin, const ContainerNode* scope)
{
- if (!scope || !scope->isInShadowTree())
+ if (!scope)
return;
ShadowRoot* shadowRoot = scope->containingShadowRoot();
@@ -192,58 +257,106 @@
}
}
-bool ScopedStyleResolver::styleSharingCandidateMatchesHostRules(const Element* element)
+void ScopedStyleResolver::collectFeaturesTo(RuleFeatureSet& features)
{
+ if (m_authorStyle)
+ features.add(m_authorStyle->features());
+
if (m_atHostRules.isEmpty())
+ return;
+
+ for (HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::iterator it = m_atHostRules.begin(); it != m_atHostRules.end(); ++it)
+ features.add(it->value->features());
+}
+
+void ScopedStyleResolver::resetAuthorStyle()
+{
+ m_authorStyle = RuleSet::create();
+ m_authorStyle->disableAutoShrinkToFit();
+ m_atHostRules.clear();
+}
+
+bool ScopedStyleResolver::checkRegionStyle(Element* regionElement)
+{
+ if (!m_authorStyle)
return false;
- ElementShadow* shadow = element->shadow();
- if (!shadow)
- return false;
-
- // FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827
- // add a new flag to ElementShadow and cache whether any@host @-rules are
- // applied to the element or not. So we can avoid always traversing
- // shadow roots.
- for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
- if (atHostRuleSetFor(shadowRoot))
+ unsigned rulesSize = m_authorStyle->m_regionSelectorsAndRuleSets.size();
+ for (unsigned i = 0; i < rulesSize; ++i) {
+ ASSERT(m_authorStyle->m_regionSelectorsAndRuleSets.at(i).ruleSet.get());
+ if (checkRegionSelector(m_authorStyle->m_regionSelectorsAndRuleSets.at(i).selector, regionElement))
return true;
-
- if (!ScopeContentDistribution::hasShadowElement(shadowRoot))
- break;
}
return false;
}
-void ScopedStyleResolver::matchHostRules(const Element* element, Vector<RuleSet*>& matchedRules)
+inline RuleSet* ScopedStyleResolver::atHostRuleSetFor(const ShadowRoot* shadowRoot) const
{
- if (m_atHostRules.isEmpty())
+ HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::const_iterator it = m_atHostRules.find(shadowRoot);
+ return it != m_atHostRules.end() ? it->value.get() : 0;
+}
+
+void ScopedStyleResolver::matchHostRules(ElementRuleCollector& collector, bool includeEmptyRules)
+{
+ if (m_atHostRules.isEmpty() || !m_scope->isElementNode())
return;
- ElementShadow* shadow = element->shadow();
+ ElementShadow* shadow = toElement(m_scope)->shadow();
if (!shadow)
return;
+ collector.clearMatchedRules();
+ collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
+
// FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827
// add a new flag to ElementShadow and cache whether any @host @-rules are
// applied to the element or not. So we can quickly exit this method
// by using the flag.
- for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
- if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot))
- matchedRules.append(ruleSet);
+ ShadowRoot* shadowRoot = shadow->youngestShadowRoot();
+ for (; shadowRoot; shadowRoot = shadowRoot->olderShadowRoot())
if (!ScopeContentDistribution::hasShadowElement(shadowRoot))
break;
+ // All shadow roots have <shadow>.
+ if (!shadowRoot)
+ shadowRoot = shadow->oldestShadowRoot();
+
+ StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
+ collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
+ for (; shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot())
+ if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot))
+ collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, m_scope), ruleRange);
+
+ collector.sortAndTransferMatchedRules();
+}
+
+void ScopedStyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, bool applyAuthorStyles)
+{
+ if (m_authorStyle) {
+ collector.clearMatchedRules();
+ collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
+
+ // Match author rules.
+ MatchRequest matchRequest(m_authorStyle.get(), includeEmptyRules, m_scope);
+ StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
+ collector.setBehaviorAtBoundary(applyAuthorStyles ? SelectorChecker::DoesNotCrossBoundary : static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
+ collector.collectMatchingRules(matchRequest, ruleRange);
+ collector.collectMatchingRulesForRegion(matchRequest, ruleRange);
+ collector.sortAndTransferMatchedRules();
}
}
+void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
+{
+ // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
+ ASSERT(m_scope->isDocumentNode());
+ collector.matchPageRules(m_authorStyle.get());
+}
+
void ScopedStyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addMember(m_authorStyles, "authorStyles");
- info.addMember(m_stack, "stack");
+ info.addMember(m_authorStyle, "authorStyle");
info.addMember(m_atHostRules, "atHostRules");
- info.addMember(m_stackParent, "stackParent");
}
-}
-
+} // namespace WebCore
diff --git a/Source/core/css/resolver/ScopedStyleResolver.h b/Source/core/css/resolver/ScopedStyleResolver.h
index 00b174f..50b8776 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.h
+++ b/Source/core/css/resolver/ScopedStyleResolver.h
@@ -27,6 +27,26 @@
#ifndef ScopedStyleResolver_h
#define ScopedStyleResolver_h
+#include "core/css/CSSRuleList.h"
+#include "core/css/CSSToStyleMap.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/DocumentRuleSets.h"
+#include "core/css/InspectorCSSOMWrappers.h"
+#include "core/css/MediaQueryExp.h"
+#include "core/css/RuleFeature.h"
+#include "core/css/RuleSet.h"
+#include "core/css/SelectorChecker.h"
+#include "core/css/SelectorFilter.h"
+#include "core/css/SiblingTraversalStrategies.h"
+#include "core/css/WebKitCSSSVGDocumentValue.h"
+#include "core/css/WebKitCSSKeyframeRule.h"
+#include "core/css/WebKitCSSKeyframesRule.h"
+#include "core/css/resolver/ViewportStyleResolver.h"
+#include "core/platform/LinkHash.h"
+#include "core/platform/ScrollTypes.h"
+#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/StyleInheritedData.h"
#include "wtf/Assertions.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
@@ -36,76 +56,114 @@
namespace WebCore {
class ContainerNode;
-class CSSStyleSheet;
-class Element;
-class RuleSet;
+class ElementRuleCollector;
+class MediaQueryEvaluator;
+class PageRuleCollector;
+class ScopedStyleResolver;
class ShadowRoot;
-class StyleRuleHost;
-struct RuleFeatureSet;
+class StyleSheetContents;
+// This class selects a RenderStyle for a given element based on a collection of stylesheets.
class ScopedStyleResolver {
+ WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); WTF_MAKE_FAST_ALLOCATED;
public:
- typedef HashMap<const ContainerNode*, OwnPtr<RuleSet> > ScopedRuleSetMap;
-
- struct StackFrame {
- StackFrame() : m_scope(0), m_authorStyleBoundsIndex(0), m_ruleSet(0) { }
- StackFrame(const ContainerNode* scope, int authorStyleBoundsIndex, RuleSet* ruleSet)
- : m_scope(scope), m_authorStyleBoundsIndex(authorStyleBoundsIndex), m_ruleSet(ruleSet)
- { }
-
- const ContainerNode* m_scope;
- int m_authorStyleBoundsIndex;
- RuleSet* m_ruleSet;
- };
-
- ScopedStyleResolver();
- ~ScopedStyleResolver();
+ static PassOwnPtr<ScopedStyleResolver> create(const ContainerNode* scope) { return adoptPtr(new ScopedStyleResolver(scope)); }
static const ContainerNode* scopeFor(const CSSStyleSheet*);
- void push(const ContainerNode* scope, const ContainerNode* scopeParent);
- void pop(const ContainerNode* scope);
- bool hasScopedStyles() const { return !m_authorStyles.isEmpty(); }
- RuleSet* ensureRuleSetFor(const ContainerNode* scope);
- bool ensureStackConsistency(ContainerNode*);
- unsigned stackSize() const { return m_stack.size(); }
- const StackFrame& stackFrameAt(unsigned index) const { return m_stack.at(index); }
- bool matchesStyleBounds(const StackFrame& frame) const { return frame.m_authorStyleBoundsIndex == m_stackParentBoundsIndex; }
- void collectFeaturesTo(RuleFeatureSet&);
+ // methods for building tree.
+ const ContainerNode* scope() const { return m_scope; }
+ const TreeScope* treeScope() const { return m_scope->treeScope(); }
+ void prepareEmptyRuleSet() { m_authorStyle = RuleSet::create(); }
+ void setParent(ScopedStyleResolver* newParent) { m_parent = newParent; }
+ ScopedStyleResolver* parent() { return m_parent; }
+public:
+ bool checkRegionStyle(Element*);
+
+ void matchHostRules(ElementRuleCollector&, bool includeEmptyRules);
+ void matchAuthorRules(ElementRuleCollector&, bool includeEmptyRules, bool applyAuthorStyles);
+ void matchPageRules(PageRuleCollector&);
+ void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, StyleResolver*);
+ void postAddRulesFromSheet() { m_authorStyle->shrinkToFit(); }
void addHostRule(StyleRuleHost*, bool hasDocumentSecurityOrigin, const ContainerNode* scope);
- bool styleSharingCandidateMatchesHostRules(const Element*);
- void matchHostRules(const Element*, Vector<RuleSet*>& matchedRules);
-
+ void collectFeaturesTo(RuleFeatureSet&);
+ void resetAuthorStyle();
void reportMemoryUsage(MemoryObjectInfo*) const;
private:
- RuleSet* ruleSetFor(const ContainerNode* scope) const;
- void setupStack(const ContainerNode*);
- bool stackIsConsistent(const ContainerNode* parent) const { return parent && parent == m_stackParent; }
+ ScopedStyleResolver() : m_scope(0), m_parent(0) { }
+ ScopedStyleResolver(const ContainerNode* scope) : m_scope(scope), m_parent(0) { }
+
RuleSet* ensureAtHostRuleSetFor(const ShadowRoot*);
RuleSet* atHostRuleSetFor(const ShadowRoot*) const;
- ScopedRuleSetMap m_authorStyles;
+ const ContainerNode* m_scope;
+ ScopedStyleResolver* m_parent;
- // Vector (used as stack) that keeps track of scoping elements (i.e., elements with a <style scoped> child)
- // encountered during tree iteration for style resolution.
- Vector<StackFrame> m_stack;
- // Element last seen as parent element when updating m_scopingElementStack.
- // This is used to decide whether m_scopingElementStack is consistent, separately from SelectorChecker::m_parentStack.
- const ContainerNode* m_stackParent;
- int m_stackParentBoundsIndex;
-
- ScopedRuleSetMap m_atHostRules;
+ OwnPtr<RuleSet> m_authorStyle;
+ HashMap<const ShadowRoot*, OwnPtr<RuleSet> > m_atHostRules;
};
-inline bool ScopedStyleResolver::ensureStackConsistency(ContainerNode* parent)
+class ScopedStyleTree {
+ WTF_MAKE_NONCOPYABLE(ScopedStyleTree); WTF_MAKE_FAST_ALLOCATED;
+public:
+ ScopedStyleTree() : m_scopeResolverForDocument(0) { }
+
+ ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope);
+ ScopedStyleResolver* scopedStyleResolverFor(const ContainerNode* scope);
+ ScopedStyleResolver* addScopedStyleResolver(const ContainerNode* scope, bool& isNewEntry);
+ void clear();
+
+ // for fast-path.
+ bool hasOnlyScopeResolverForDocument() const { return m_scopeResolverForDocument && m_authorStyles.size() == 1; }
+ ScopedStyleResolver* scopedStyleResolverForDocument() { return m_scopeResolverForDocument; }
+
+ void resolveScopeStyles(const Element*, Vector<std::pair<ScopedStyleResolver*, bool>, 8>& resolvers);
+ ScopedStyleResolver* scopedResolverFor(const Element*);
+
+ void pushStyleCache(const ContainerNode* scope, const ContainerNode* parent);
+ void popStyleCache(const ContainerNode* scope);
+
+ void collectFeaturesTo(RuleFeatureSet& features);
+
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+private:
+ void setupScopeStylesTree(ScopedStyleResolver* target);
+
+ bool cacheIsValid(const ContainerNode* parent) const { return parent && parent == m_cache.nodeForScopeStyles; }
+ void resolveStyleCache(const ContainerNode* scope);
+ ScopedStyleResolver* enclosingScopedStyleResolverFor(const ContainerNode* scope, int& authorStyleBoundsIndex);
+
+private:
+ HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> > m_authorStyles;
+ ScopedStyleResolver* m_scopeResolverForDocument;
+
+ struct ScopeStyleCache {
+ ScopedStyleResolver* scopeResolver;
+ int scopeResolverBoundsIndex;
+ const ContainerNode* nodeForScopeStyles;
+ int authorStyleBoundsIndex;
+
+ void clear()
+ {
+ scopeResolver = 0;
+ scopeResolverBoundsIndex = 0;
+ nodeForScopeStyles = 0;
+ authorStyleBoundsIndex = 0;
+ }
+ };
+ ScopeStyleCache m_cache;
+};
+
+inline ScopedStyleResolver* ScopedStyleTree::scopedResolverFor(const Element* element)
{
- // Match scoped author rules by traversing the scoped element stack (rebuild it if it got inconsistent).
- if (!stackIsConsistent(parent))
- setupStack(parent);
- return !m_stack.isEmpty();
+ if (!cacheIsValid(element))
+ resolveStyleCache(element);
+
+ return m_cache.scopeResolver;
}
+
} // namespace WebCore
#endif // ScopedStyleResolver_h
diff --git a/Source/core/css/resolver/StyleBuilder.h b/Source/core/css/resolver/StyleBuilder.h
new file mode 100644
index 0000000..ca5e575
--- /dev/null
+++ b/Source/core/css/resolver/StyleBuilder.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StyleBuilder_h
+#define StyleBuilder_h
+
+#include "CSSPropertyNames.h"
+
+namespace WebCore {
+
+class CSSValue;
+class StyleResolver;
+
+class StyleBuilder {
+public:
+ static bool applyProperty(CSSPropertyID, StyleResolver*, CSSValue*, bool isInitial, bool isInherit);
+};
+
+}
+
+#endif
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index e90aeae..02f06a1 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -33,9 +33,11 @@
#include "HTMLNames.h"
#include "MathMLNames.h"
#include "RuntimeEnabledFeatures.h"
+#include "SVGNames.h"
#include "UserAgentStyleSheets.h"
#include "WebKitFontFamilyNames.h"
#include "XMLNames.h"
+#include "core/animation/AnimatableValue.h"
#include "core/animation/Animation.h"
#include "core/css/CSSBorderImage.h"
#include "core/css/CSSCalculationValue.h"
@@ -43,6 +45,7 @@
#include "core/css/CSSDefaultStyleSheets.h"
#include "core/css/CSSFontFaceRule.h"
#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSLineBoxContainValue.h"
#include "core/css/CSSPageRule.h"
#include "core/css/CSSParser.h"
@@ -76,8 +79,12 @@
#include "core/css/StyleSheetList.h"
#include "core/css/WebKitCSSKeyframeRule.h"
#include "core/css/WebKitCSSKeyframesRule.h"
+#include "core/css/WebKitCSSMixFunctionValue.h"
#include "core/css/WebKitCSSRegionRule.h"
+#include "core/css/WebKitCSSSVGDocumentValue.h"
+#include "core/css/WebKitCSSShaderValue.h"
#include "core/css/resolver/FilterOperationResolver.h"
+#include "core/css/resolver/StyleBuilder.h"
#include "core/css/resolver/TransformBuilder.h"
#include "core/css/resolver/ViewportStyleResolver.h"
#include "core/dom/Attribute.h"
@@ -99,14 +106,24 @@
#include "core/html/HTMLProgressElement.h"
#include "core/html/HTMLStyleElement.h"
#include "core/html/HTMLTextAreaElement.h"
+#include "core/html/track/WebVTTElement.h"
#include "core/inspector/InspectorInstrumentation.h"
+#include "core/loader/cache/CachedDocument.h"
#include "core/loader/cache/CachedImage.h"
+#include "core/loader/cache/CachedSVGDocumentReference.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
#include "core/page/Settings.h"
#include "core/platform/CalculationValue.h"
#include "core/platform/LinkHash.h"
+#include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h"
+#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
+#include "core/platform/graphics/filters/custom/CustomFilterNumberParameter.h"
+#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
+#include "core/platform/graphics/filters/custom/CustomFilterParameter.h"
+#include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h"
+#include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h"
#include "core/platform/text/LocaleToScriptMapping.h"
#include "core/rendering/RenderRegion.h"
#include "core/rendering/RenderScrollbar.h"
@@ -121,10 +138,19 @@
#include "core/rendering/style/RenderStyleConstants.h"
#include "core/rendering/style/ShadowData.h"
#include "core/rendering/style/StyleCachedImage.h"
+#include "core/rendering/style/StyleCachedImageSet.h"
+#include "core/rendering/style/StyleCachedShader.h"
+#include "core/rendering/style/StyleCustomFilterProgram.h"
+#include "core/rendering/style/StyleCustomFilterProgramCache.h"
#include "core/rendering/style/StyleGeneratedImage.h"
#include "core/rendering/style/StylePendingImage.h"
+#include "core/rendering/style/StylePendingShader.h"
+#include "core/rendering/style/StyleShader.h"
+#include "core/svg/SVGDocument.h"
#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGElement.h"
#include "core/svg/SVGFontFaceElement.h"
+#include "core/svg/SVGURIReference.h"
#include "weborigin/SecurityOrigin.h"
#include "wtf/MemoryInstrumentationHashMap.h"
#include "wtf/MemoryInstrumentationHashSet.h"
@@ -132,34 +158,6 @@
#include "wtf/StdLibExtras.h"
#include "wtf/Vector.h"
-#if ENABLE(SVG)
-#include "SVGNames.h"
-#include "core/css/WebKitCSSSVGDocumentValue.h"
-#include "core/loader/cache/CachedSVGDocument.h"
-#include "core/loader/cache/CachedSVGDocumentReference.h"
-#include "core/svg/SVGDocument.h"
-#include "core/svg/SVGElement.h"
-#include "core/svg/SVGURIReference.h"
-#endif
-
-#include "core/css/CSSImageSetValue.h"
-#include "core/css/WebKitCSSMixFunctionValue.h"
-#include "core/css/WebKitCSSShaderValue.h"
-#include "core/html/track/WebVTTElement.h"
-#include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h"
-#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
-#include "core/platform/graphics/filters/custom/CustomFilterNumberParameter.h"
-#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
-#include "core/platform/graphics/filters/custom/CustomFilterParameter.h"
-#include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-#include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h"
-#include "core/rendering/style/StyleCachedImageSet.h"
-#include "core/rendering/style/StyleCachedShader.h"
-#include "core/rendering/style/StyleCustomFilterProgram.h"
-#include "core/rendering/style/StyleCustomFilterProgramCache.h"
-#include "core/rendering/style/StylePendingShader.h"
-#include "core/rendering/style/StyleShader.h"
-
using namespace std;
namespace WTF {
@@ -191,7 +189,7 @@
static StylePropertySet* leftToRightDeclaration()
{
- DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, leftToRightDecl, (StylePropertySet::create()));
+ DEFINE_STATIC_LOCAL(RefPtr<MutableStylePropertySet>, leftToRightDecl, (MutableStylePropertySet::create()));
if (leftToRightDecl->isEmpty())
leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr);
return leftToRightDecl.get();
@@ -199,7 +197,7 @@
static StylePropertySet* rightToLeftDeclaration()
{
- DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, rightToLeftDecl, (StylePropertySet::create()));
+ DEFINE_STATIC_LOCAL(RefPtr<MutableStylePropertySet>, rightToLeftDecl, (MutableStylePropertySet::create()));
if (rightToLeftDecl->isEmpty())
rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl);
return rightToLeftDecl.get();
@@ -250,7 +248,7 @@
if (m_rootDefaultStyle && view)
m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->frame(), m_rootDefaultStyle.get()));
- m_ruleSets.resetAuthorStyle();
+ m_styleTree.clear();
DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCollection();
m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this);
@@ -269,7 +267,31 @@
void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >& styleSheets)
{
- m_ruleSets.appendAuthorStyleSheets(firstNew, styleSheets, m_medium.get(), m_inspectorCSSOMWrappers, document()->isViewSource(), this);
+ // This handles sheets added to the end of the stylesheet list only. In other cases the style resolver
+ // needs to be reconstructed. To handle insertions too the rule order numbers would need to be updated.
+ ScopedStyleResolver* lastUpdatedResolver = 0;
+ unsigned size = styleSheets.size();
+ for (unsigned i = firstNew; i < size; ++i) {
+ CSSStyleSheet* cssSheet = styleSheets[i].get();
+ ASSERT(!cssSheet->disabled());
+ if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), this))
+ continue;
+
+ StyleSheetContents* sheet = cssSheet->contents();
+ ScopedStyleResolver* resolver = ensureScopedStyleResolver(ScopedStyleResolver::scopeFor(cssSheet));
+ ASSERT(resolver);
+ resolver->addRulesFromSheet(sheet, *m_medium, this);
+ m_inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet);
+
+ if (lastUpdatedResolver && lastUpdatedResolver != resolver)
+ lastUpdatedResolver->postAddRulesFromSheet();
+ lastUpdatedResolver = resolver;
+ }
+
+ if (lastUpdatedResolver)
+ lastUpdatedResolver->postAddRulesFromSheet();
+ collectFeatures();
+
if (document()->renderer() && document()->renderer()->style())
document()->renderer()->style()->font().update(fontSelector());
@@ -278,6 +300,33 @@
#endif
}
+void StyleResolver::resetAuthorStyle()
+{
+ m_styleTree.clear();
+}
+
+static PassOwnPtr<RuleSet> makeRuleSet(const Vector<RuleFeature>& rules)
+{
+ size_t size = rules.size();
+ if (!size)
+ return nullptr;
+ OwnPtr<RuleSet> ruleSet = RuleSet::create();
+ for (size_t i = 0; i < size; ++i)
+ ruleSet->addRule(rules[i].rule, rules[i].selectorIndex, rules[i].hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState);
+ ruleSet->shrinkToFit();
+ return ruleSet.release();
+}
+
+void StyleResolver::collectFeatures()
+{
+ m_features.clear();
+ m_ruleSets.collectFeaturesTo(m_features, document()->isViewSource());
+ m_styleTree.collectFeaturesTo(m_features);
+
+ m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
+ m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
+}
+
void StyleResolver::pushParentElement(Element* parent)
{
const ContainerNode* parentsParent = parent->parentOrShadowHostElement();
@@ -292,8 +341,7 @@
m_selectorFilter.pushParent(parent);
// Note: We mustn't skip ShadowRoot nodes for the scope stack.
- if (m_scopeResolver)
- m_scopeResolver->push(parent, parent->parentOrShadowHostNode());
+ m_styleTree.pushStyleCache(parent, parent->parentOrShadowHostNode());
}
void StyleResolver::popParentElement(Element* parent)
@@ -302,22 +350,20 @@
// Pause maintaining the stack in this case.
if (m_selectorFilter.parentStackIsConsistent(parent))
m_selectorFilter.popParent();
- if (m_scopeResolver)
- m_scopeResolver->pop(parent);
+
+ m_styleTree.popStyleCache(parent);
}
void StyleResolver::pushParentShadowRoot(const ShadowRoot* shadowRoot)
{
ASSERT(shadowRoot->host());
- if (m_scopeResolver)
- m_scopeResolver->push(shadowRoot, shadowRoot->host());
+ m_styleTree.pushStyleCache(shadowRoot, shadowRoot->host());
}
void StyleResolver::popParentShadowRoot(const ShadowRoot* shadowRoot)
{
ASSERT(shadowRoot->host());
- if (m_scopeResolver)
- m_scopeResolver->pop(shadowRoot);
+ m_styleTree.popStyleCache(shadowRoot);
}
// This is a simplified style setting function for keyframe styles
@@ -359,21 +405,16 @@
m_matchedPropertiesCacheAdditionsSinceLastSweep = 0;
}
-inline bool StyleResolver::styleSharingCandidateMatchesHostRules()
-{
- return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_state.element());
-}
-
bool StyleResolver::classNamesAffectedByRules(const SpaceSplitString& classNames) const
{
for (unsigned i = 0; i < classNames.size(); ++i) {
- if (m_ruleSets.features().classesInRules.contains(classNames[i].impl()))
+ if (m_features.classesInRules.contains(classNames[i].impl()))
return true;
}
return false;
}
-inline void StyleResolver::matchShadowDistributedRules(ElementRuleCollector& collector, bool includeEmptyRules, StyleResolver::RuleRange& ruleRange)
+inline void StyleResolver::matchShadowDistributedRules(ElementRuleCollector& collector, bool includeEmptyRules)
{
if (m_ruleSets.shadowDistributedRules().isEmpty())
return;
@@ -383,87 +424,52 @@
collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::CrossesBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
collector.setCanUseFastReject(false);
+ collector.clearMatchedRules();
+ collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
+ RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
+
Vector<MatchRequest> matchRequests;
m_ruleSets.shadowDistributedRules().collectMatchRequests(includeEmptyRules, matchRequests);
for (size_t i = 0; i < matchRequests.size(); ++i)
collector.collectMatchingRules(matchRequests[i], ruleRange);
+ collector.sortAndTransferMatchedRules();
collector.setBehaviorAtBoundary(previousBoundary);
collector.setCanUseFastReject(previousCanUseFastReject);
}
-void StyleResolver::matchHostRules(ElementRuleCollector& collector, bool includeEmptyRules)
+void StyleResolver::matchHostRules(ScopedStyleResolver* resolver, ElementRuleCollector& collector, bool includeEmptyRules)
{
- ASSERT(m_scopeResolver);
-
- collector.clearMatchedRules();
- collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
-
- Vector<RuleSet*> matchedRules;
- m_scopeResolver->matchHostRules(m_state.element(), matchedRules);
- if (matchedRules.isEmpty())
+ if (m_state.element() != resolver->scope())
return;
-
- for (unsigned i = matchedRules.size(); i > 0; --i) {
- StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
- collector.collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_state.element()), ruleRange);
- }
- collector.sortAndTransferMatchedRules();
+ resolver->matchHostRules(collector, includeEmptyRules);
}
void StyleResolver::matchScopedAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules)
{
- if (!m_scopeResolver)
+ // fast path
+ if (m_styleTree.hasOnlyScopeResolverForDocument()) {
+ m_styleTree.scopedStyleResolverForDocument()->matchAuthorRules(collector, includeEmptyRules, true);
return;
-
- // Match scoped author rules by traversing the scoped element stack (rebuild it if it got inconsistent).
- if (m_scopeResolver->hasScopedStyles() && m_scopeResolver->ensureStackConsistency(m_state.element())) {
- bool applyAuthorStyles = m_state.element()->treeScope()->applyAuthorStyles();
- bool documentScope = true;
-
- unsigned scopeSize = m_scopeResolver->stackSize();
- for (unsigned i = 0; i < scopeSize; ++i) {
- collector.clearMatchedRules();
- collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
-
- const ScopedStyleResolver::StackFrame& frame = m_scopeResolver->stackFrameAt(i);
- documentScope = documentScope && !frame.m_scope->isInShadowTree();
- if (documentScope) {
- if (!applyAuthorStyles)
- continue;
- } else {
- if (!m_scopeResolver->matchesStyleBounds(frame))
- continue;
- }
-
- MatchRequest matchRequest(frame.m_ruleSet, includeEmptyRules, frame.m_scope);
- StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
- collector.collectMatchingRules(matchRequest, ruleRange);
- collector.collectMatchingRulesForRegion(matchRequest, ruleRange);
- collector.sortAndTransferMatchedRules();
- }
}
- matchHostRules(collector, includeEmptyRules);
+ Vector<std::pair<ScopedStyleResolver*, bool>, 8> stack;
+ m_styleTree.resolveScopeStyles(m_state.element(), stack);
+ if (stack.isEmpty())
+ return;
+
+ for (int i = stack.size() - 1; i >= 0; --i) {
+ ScopedStyleResolver* scopeResolver = stack.at(i).first;
+ bool applyAuthorStyles = stack.at(i).second;
+ scopeResolver->matchAuthorRules(collector, includeEmptyRules, applyAuthorStyles);
+ }
+ matchHostRules(stack.first().first, collector, includeEmptyRules);
}
void StyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules)
{
- collector.clearMatchedRules();
- collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
-
- if (!m_state.element())
- return;
-
- // Match global author rules.
- MatchRequest matchRequest(m_ruleSets.authorStyle(), includeEmptyRules);
- StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
- collector.collectMatchingRules(matchRequest, ruleRange);
- collector.collectMatchingRulesForRegion(matchRequest, ruleRange);
- matchShadowDistributedRules(collector, includeEmptyRules, ruleRange);
- collector.sortAndTransferMatchedRules();
-
matchScopedAuthorRules(collector, includeEmptyRules);
+ matchShadowDistributedRules(collector, includeEmptyRules);
}
void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool includeEmptyRules)
@@ -554,13 +560,9 @@
collector.addElementStyleProperties(m_state.styledElement()->inlineStyle(), isInlineStyleCacheable);
}
-#if ENABLE(SVG)
// Now check SMIL animation override style.
if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->isSVGElement())
collector.addElementStyleProperties(toSVGElement(m_state.styledElement())->animatedSMILStyleProperties(), false /* isCacheable */);
-#else
- UNUSED_PARAM(includeSMILProperties);
-#endif
if (m_state.styledElement() && m_state.styledElement()->hasActiveAnimations())
collector.matchedResult().isCacheable = false;
@@ -598,11 +600,9 @@
StyledElement* p = static_cast<StyledElement*>(parent);
if (p->inlineStyle())
return 0;
-#if ENABLE(SVG)
if (p->isSVGElement() && toSVGElement(p)->animatedSMILStyleProperties())
return 0;
-#endif
- if (p->hasID() && m_ruleSets.features().idsInRules.contains(p->idForStyleResolution().impl()))
+ if (p->hasID() && m_features.idsInRules.contains(p->idForStyleResolution().impl()))
return 0;
RenderStyle* parentStyle = p->renderStyle();
@@ -714,20 +714,16 @@
if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames()))
return false;
} else if (sharingCandidate->hasClass()) {
-#if ENABLE(SVG)
// SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG.
if (state.element()->isSVGElement()) {
if (state.element()->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))
return false;
- } else {
-#endif
- if (state.element()->classNames() != sharingCandidate->classNames())
- return false;
-#if ENABLE(SVG)
+ } else if (state.element()->classNames() != sharingCandidate->classNames()) {
+ return false;
}
-#endif
- } else
+ } else {
return false;
+ }
if (state.styledElement()->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())
return false;
@@ -757,10 +753,8 @@
return false;
if (element->needsStyleRecalc())
return false;
-#if ENABLE(SVG)
if (element->isSVGElement() && toSVGElement(element)->animatedSMILStyleProperties())
return false;
-#endif
if (element->isLink() != state.element()->isLink())
return false;
if (element->hovered() != state.element()->hovered())
@@ -778,7 +772,7 @@
if (element->additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle())
return false;
- if (element->hasID() && m_ruleSets.features().idsInRules.contains(element->idForStyleResolution().impl()))
+ if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl()))
return false;
if (element->hasScopedHTMLStyleChild())
return false;
@@ -848,12 +842,10 @@
// If the element has inline style it is probably unique.
if (state.styledElement()->inlineStyle())
return 0;
-#if ENABLE(SVG)
if (state.styledElement()->isSVGElement() && toSVGElement(state.styledElement())->animatedSMILStyleProperties())
return 0;
-#endif
// Ids stop style sharing if they show up in the stylesheets.
- if (state.styledElement()->hasID() && m_ruleSets.features().idsInRules.contains(state.styledElement()->idForStyleResolution().impl()))
+ if (state.styledElement()->hasID() && m_features.idsInRules.contains(state.styledElement()->idForStyleResolution().impl()))
return 0;
if (parentElementPreventsSharing(state.element()->parentElement()))
return 0;
@@ -887,13 +879,10 @@
return 0;
// Can't share if sibling rules apply. This is checked at the end as it should rarely fail.
- if (styleSharingCandidateMatchesRuleSet(m_ruleSets.sibling()))
+ if (styleSharingCandidateMatchesRuleSet(m_siblingRuleSet.get()))
return 0;
// Can't share if attribute rules apply.
- if (styleSharingCandidateMatchesRuleSet(m_ruleSets.uncommonAttribute()))
- return 0;
- // Can't share if @host @-rules apply.
- if (styleSharingCandidateMatchesHostRules())
+ if (styleSharingCandidateMatchesRuleSet(m_uncommonAttributeRuleSet.get()))
return 0;
// Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
if (parentElementPreventsSharing(state.element()->parentElement()))
@@ -1136,7 +1125,7 @@
bool needsCollection = false;
CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(element, needsCollection);
if (needsCollection) {
- m_ruleSets.collectFeatures(document()->isViewSource(), m_scopeResolver.get());
+ collectFeatures();
m_inspectorCSSOMWrappers.reset();
}
@@ -1342,7 +1331,9 @@
collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle);
collector.matchPageRules(m_ruleSets.userStyle());
- collector.matchPageRules(m_ruleSets.authorStyle());
+
+ if (ScopedStyleResolver* scopeResolver = m_styleTree.scopedStyleResolverForDocument())
+ scopeResolver->matchPageRules(collector);
m_state.setLineHeightValue(0);
bool inheritedOnly = false;
@@ -1475,6 +1466,11 @@
return display == FLEX || display == INLINE_FLEX;
}
+static bool isDisplayGridBox(EDisplay display)
+{
+ return display == GRID || display == INLINE_GRID;
+}
+
void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
{
ASSERT(parentStyle);
@@ -1562,7 +1558,7 @@
if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
style->setWritingMode(TopToBottomWritingMode);
- if (isDisplayFlexibleBox(parentStyle->display())) {
+ if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentStyle->display())) {
style->setFloating(NoFloat);
style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document()->inQuirksMode()));
}
@@ -1682,7 +1678,6 @@
adjustGridItemPosition(style);
-#if ENABLE(SVG)
if (e && e->isSVGElement()) {
// Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty
if (style->overflowY() == OSCROLL)
@@ -1704,7 +1699,6 @@
if (e->hasTagName(SVGNames::foreignObjectTag))
style->setEffectiveZoom(RenderStyle::initialZoom());
}
-#endif
}
void StyleResolver::adjustGridItemPosition(RenderStyle* style) const
@@ -1726,15 +1720,12 @@
// FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment,
// so all region rules are global by default. Verify whether that can stand or needs changing.
- unsigned rulesSize = m_ruleSets.authorStyle()->m_regionSelectorsAndRuleSets.size();
- for (unsigned i = 0; i < rulesSize; ++i) {
- ASSERT(m_ruleSets.authorStyle()->m_regionSelectorsAndRuleSets.at(i).ruleSet.get());
- if (checkRegionSelector(m_ruleSets.authorStyle()->m_regionSelectorsAndRuleSets.at(i).selector, regionElement))
+ if (ScopedStyleResolver* scopeResolver = m_styleTree.scopedStyleResolverForDocument())
+ if (scopeResolver->checkRegionStyle(regionElement))
return true;
- }
if (m_ruleSets.userStyle()) {
- rulesSize = m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.size();
+ unsigned rulesSize = m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.size();
for (unsigned i = 0; i < rulesSize; ++i) {
ASSERT(m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.at(i).ruleSet.get());
if (checkRegionSelector(m_ruleSets.userStyle()->m_regionSelectorsAndRuleSets.at(i).selector, regionElement))
@@ -1833,28 +1824,28 @@
for (size_t i = 0; i < animations->size(); ++i) {
RefPtr<Animation> animation = animations->at(i);
- RefPtr<StylePropertySet> properties = animation->cachedStyle();
- for (unsigned j = 0; j < properties->propertyCount(); ++j) {
- StylePropertySet::PropertyReference current = properties->propertyAt(j);
- CSSPropertyID property = current.id();
+ const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
+ for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
+ CSSPropertyID property = iter->key;
+ // FIXME: Composite onto the underlying value.
+ RefPtr<CSSValue> value = iter->value->composite(AnimatableValue()).toCSSValue();
switch (pass) {
case VariableDefinitions:
ASSERT_NOT_REACHED();
continue;
case HighPriorityProperties:
if (property < CSSPropertyLineHeight)
- applyProperty(current.id(), current.value());
+ applyProperty(property, value.get());
else if (property == CSSPropertyLineHeight)
- m_state.setLineHeightValue(current.value());
+ m_state.setLineHeightValue(value.get());
continue;
case LowPriorityProperties:
if (property > CSSPropertyLineHeight)
- applyProperty(current.id(), current.value());
+ applyProperty(property, value.get());
continue;
}
}
}
-
}
template <StyleResolver::StyleApplicationPass pass>
@@ -2071,7 +2062,7 @@
state.setLineHeightValue(0);
applyMatchedProperties<HighPriorityProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
// Animation contributions are processed here because CSS Animations are overridable by user !important rules.
- if (RuntimeEnabledFeatures::webAnimationEnabled())
+ if (RuntimeEnabledFeatures::webAnimationsEnabled())
applyAnimatedProperties<HighPriorityProperties>(element);
applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
@@ -2101,7 +2092,7 @@
// Now do the author and user normal priority properties and all the !important properties.
applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
- if (RuntimeEnabledFeatures::webAnimationEnabled())
+ if (RuntimeEnabledFeatures::webAnimationsEnabled())
applyAnimatedProperties<LowPriorityProperties>(element);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
@@ -2142,7 +2133,9 @@
case CSSPropertyBorderTopColor:
case CSSPropertyBorderBottomColor:
case CSSPropertyColor:
+ case CSSPropertyFill:
case CSSPropertyOutlineColor:
+ case CSSPropertyStroke:
case CSSPropertyWebkitColumnRuleColor:
#if ENABLE(CSS3_TEXT)
case CSSPropertyWebkitTextDecorationColor:
@@ -2150,10 +2143,6 @@
case CSSPropertyWebkitTextEmphasisColor:
case CSSPropertyWebkitTextFillColor:
case CSSPropertyWebkitTextStrokeColor:
-#if ENABLE(SVG)
- case CSSPropertyFill:
- case CSSPropertyStroke:
-#endif
return true;
default:
break;
@@ -2324,28 +2313,47 @@
static bool createGridPosition(CSSValue* value, GridPosition& position)
{
- // For now, we only accept: 'auto' | <integer> | span && <integer>?
+ // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <integer>?
+
if (value->isPrimitiveValue()) {
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getIdent() == CSSValueAuto)
- return true;
-
- if (primitiveValue->getIdent() == CSSValueSpan) {
- // If the <integer> is omitted, it defaults to '1'.
- position.setSpanPosition(1);
- return true;
- }
-
- ASSERT(primitiveValue->isNumber());
- position.setIntegerPosition(primitiveValue->getIntValue());
+ ASSERT(primitiveValue->getIdent() == CSSValueAuto);
return true;
}
CSSValueList* values = toCSSValueList(value);
- ASSERT(values->length() == 2);
- CSSPrimitiveValue* numericValue = toCSSPrimitiveValue(values->itemWithoutBoundsCheck(1));
- ASSERT(numericValue->isNumber());
- position.setSpanPosition(numericValue->getIntValue());
+ ASSERT(values->length());
+
+ bool isSpanPosition = false;
+ // The specification makes the <integer> optional, in which case it default to '1'.
+ int gridLineNumber = 1;
+ String gridLineName;
+
+ CSSValueListIterator it = values;
+ CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value());
+ if (currentValue->getIdent() == CSSValueSpan) {
+ isSpanPosition = true;
+ it.advance();
+ currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
+ }
+
+ if (currentValue && currentValue->isNumber()) {
+ gridLineNumber = currentValue->getIntValue();
+ it.advance();
+ currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
+ }
+
+ if (currentValue && currentValue->isString()) {
+ gridLineName = currentValue->getStringValue();
+ it.advance();
+ }
+
+ ASSERT(!it.hasMore());
+ if (isSpanPosition)
+ position.setSpanPosition(gridLineNumber, gridLineName);
+ else
+ position.setExplicitPosition(gridLineNumber, gridLineName);
+
return true;
}
@@ -2385,7 +2393,7 @@
knownExpressions.append(expression);
// FIXME: It would be faster not to re-parse from strings, but for now CSS property validation lives inside the parser so we do it there.
- RefPtr<StylePropertySet> resultSet = StylePropertySet::create();
+ RefPtr<MutableStylePropertySet> resultSet = MutableStylePropertySet::create();
if (!CSSParser::parseValue(resultSet.get(), id, expression.second, false, document()))
return; // expression failed to parse.
@@ -2445,6 +2453,10 @@
return;
}
+ // Use the new StyleBuilder.
+ if (StyleBuilder::applyProperty(id, this, value, isInitial, isInherit))
+ return;
+
CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
float zoomFactor = state.style()->effectiveZoom();
@@ -2506,7 +2518,7 @@
state.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);
didSet = true;
// register the fact that the attribute value affects the style
- m_ruleSets.features().attrsInRules.add(attr.localName().impl());
+ m_features.attrsInRules.add(attr.localName().impl());
} else if (contentValue->isCounter()) {
Counter* counterValue = contentValue->getCounterValue();
EListStyleType listStyleType = NoneListStyle;
@@ -2670,7 +2682,6 @@
case CSSPropertyWebkitTextStroke:
case CSSPropertyWebkitTransition:
case CSSPropertyWebkitTransformOrigin:
- case CSSPropertyWebkitWrap:
ASSERT(isExpandedShorthand(id));
ASSERT_NOT_REACHED();
break;
@@ -2872,17 +2883,14 @@
}
case CSSPropertyFontStretch:
case CSSPropertyPage:
- case CSSPropertyTextLineThrough:
case CSSPropertyTextLineThroughColor:
case CSSPropertyTextLineThroughMode:
case CSSPropertyTextLineThroughStyle:
case CSSPropertyTextLineThroughWidth:
- case CSSPropertyTextOverline:
case CSSPropertyTextOverlineColor:
case CSSPropertyTextOverlineMode:
case CSSPropertyTextOverlineStyle:
case CSSPropertyTextOverlineWidth:
- case CSSPropertyTextUnderline:
case CSSPropertyTextUnderlineColor:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
@@ -2962,6 +2970,7 @@
return;
}
case CSSPropertyWebkitGridAutoColumns: {
+ HANDLE_INHERIT_AND_INITIAL(gridAutoColumns, GridAutoColumns);
GridTrackSize trackSize;
if (!createGridTrackSize(value, trackSize, state))
return;
@@ -2969,6 +2978,7 @@
return;
}
case CSSPropertyWebkitGridAutoRows: {
+ HANDLE_INHERIT_AND_INITIAL(gridAutoRows, GridAutoRows);
GridTrackSize trackSize;
if (!createGridTrackSize(value, trackSize, state))
return;
@@ -2976,6 +2986,17 @@
return;
}
case CSSPropertyWebkitGridColumns: {
+ if (isInherit) {
+ m_state.style()->setGridColumns(m_state.parentStyle()->gridColumns());
+ m_state.style()->setNamedGridColumnLines(m_state.parentStyle()->namedGridColumnLines());
+ return;
+ }
+ if (isInitial) {
+ m_state.style()->setGridColumns(RenderStyle::initialGridColumns());
+ m_state.style()->setNamedGridColumnLines(RenderStyle::initialNamedGridColumnLines());
+ return;
+ }
+
Vector<GridTrackSize> trackSizes;
NamedGridLinesMap namedGridLines;
if (!createGridTrackList(value, trackSizes, namedGridLines, state))
@@ -2985,6 +3006,17 @@
return;
}
case CSSPropertyWebkitGridRows: {
+ if (isInherit) {
+ m_state.style()->setGridRows(m_state.parentStyle()->gridRows());
+ m_state.style()->setNamedGridRowLines(m_state.parentStyle()->namedGridRowLines());
+ return;
+ }
+ if (isInitial) {
+ m_state.style()->setGridRows(RenderStyle::initialGridRows());
+ m_state.style()->setNamedGridRowLines(RenderStyle::initialNamedGridRowLines());
+ return;
+ }
+
Vector<GridTrackSize> trackSizes;
NamedGridLinesMap namedGridLines;
if (!createGridTrackList(value, trackSizes, namedGridLines, state))
@@ -3034,7 +3066,7 @@
case CSSPropertyTransitionProperty:
case CSSPropertyTransitionTimingFunction:
return;
- // These properties are implemented in the DeprecatedStyleBuilder lookup table.
+ // These properties are implemented in the DeprecatedStyleBuilder lookup table or in the new StyleBuilder.
case CSSPropertyBackgroundAttachment:
case CSSPropertyBackgroundBlendMode:
case CSSPropertyBackgroundClip:
@@ -3133,6 +3165,7 @@
case CSSPropertyTextRendering:
case CSSPropertyTextTransform:
case CSSPropertyTop:
+ case CSSPropertyTouchAction:
case CSSPropertyUnicodeBidi:
case CSSPropertyVariable:
case CSSPropertyVerticalAlign:
@@ -3283,10 +3316,8 @@
ASSERT_NOT_REACHED();
return;
default:
-#if ENABLE(SVG)
// Try the SVG properties
applySVGProperty(id, value);
-#endif
return;
}
}
@@ -3590,7 +3621,6 @@
return false;
}
-#if ENABLE(SVG)
void StyleResolver::loadPendingSVGDocuments()
{
StyleResolverState& state = m_state;
@@ -3607,17 +3637,16 @@
WebKitCSSSVGDocumentValue* value = state.pendingSVGDocuments().get(referenceFilter);
if (!value)
continue;
- CachedSVGDocument* cachedDocument = value->load(cachedResourceLoader);
+ CachedDocument* cachedDocument = value->load(cachedResourceLoader);
if (!cachedDocument)
continue;
- // Stash the CachedSVGDocument on the reference filter.
+ // Stash the CachedDocument on the reference filter.
referenceFilter->setCachedSVGDocumentReference(adoptPtr(new CachedSVGDocumentReference(cachedDocument)));
}
}
state.pendingSVGDocuments().clear();
}
-#endif
void StyleResolver::loadPendingShaders()
{
@@ -3777,10 +3806,8 @@
// Start loading the shaders referenced by this style.
loadPendingShaders();
-#if ENABLE(SVG)
// Start loading the SVG Documents referenced by this style.
loadPendingSVGDocuments();
-#endif
}
inline StyleResolver::MatchedProperties::MatchedProperties()
@@ -3817,7 +3844,6 @@
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addMember(m_ruleSets, "ruleSets");
- info.addMember(m_keyframesRuleMap, "keyframesRuleMap");
info.addMember(m_matchedPropertiesCache, "matchedPropertiesCache");
info.addMember(m_matchedPropertiesCacheSweepTimer, "matchedPropertiesCacheSweepTimer");
@@ -3829,8 +3855,8 @@
info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMediaQueryResults");
info.ignoreMember(m_styleBuilder);
info.addMember(m_inspectorCSSOMWrappers);
- info.addMember(m_scopeResolver, "scopeResolver");
+ info.addMember(m_styleTree, "scopedStyleTree");
info.addMember(m_state, "state");
// FIXME: move this to a place where it would be called only once?
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index 34bdfcb..f100ae2 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -34,9 +34,7 @@
#include "core/css/SelectorChecker.h"
#include "core/css/SelectorFilter.h"
#include "core/css/SiblingTraversalStrategies.h"
-#if ENABLE(SVG)
#include "core/css/WebKitCSSSVGDocumentValue.h"
-#endif
#include "core/css/resolver/ScopedStyleResolver.h"
#include "core/css/resolver/StyleResolverState.h"
#include "core/css/resolver/ViewportStyleResolver.h"
@@ -90,6 +88,7 @@
class RenderScrollbar;
class RuleData;
class RuleSet;
+class ScopedStyleResolver;
class Settings;
class StaticCSSRuleList;
class StyleCustomFilterProgramCache;
@@ -177,7 +176,6 @@
void popParentElement(Element*);
void pushParentShadowRoot(const ShadowRoot*);
void popParentShadowRoot(const ShadowRoot*);
- void addHostRule(StyleRuleHost* rule, bool hasDocumentSecurityOrigin, const ContainerNode* scope) { ensureScopeResolver()->addHostRule(rule, hasDocumentSecurityOrigin, scope); }
PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0);
@@ -201,29 +199,26 @@
RenderStyle* rootElementStyle() const { return m_state.rootElementStyle(); }
Element* element() { return m_state.element(); }
Document* document() { return m_document; }
- ScopedStyleResolver* scopeResolver() const { return m_scopeResolver.get(); }
bool hasParentNode() const { return m_state.parentNode(); }
// FIXME: It could be better to call m_ruleSets.appendAuthorStyleSheets() directly after we factor StyleRsolver further.
// https://bugs.webkit.org/show_bug.cgi?id=108890
void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >&);
+ void resetAuthorStyle();
DocumentRuleSets& ruleSets() { return m_ruleSets; }
const DocumentRuleSets& ruleSets() const { return m_ruleSets; }
SelectorFilter& selectorFilter() { return m_selectorFilter; }
- ScopedStyleResolver* ensureScopeResolver()
+ ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope)
{
- if (!m_scopeResolver)
- m_scopeResolver = adoptPtr(new ScopedStyleResolver());
- return m_scopeResolver.get();
+ return m_styleTree.ensureScopedStyleResolver(scope ? scope : document());
}
private:
void initElement(Element*);
RenderStyle* locateSharedStyle();
bool styleSharingCandidateMatchesRuleSet(RuleSet*);
- bool styleSharingCandidateMatchesHostRules();
Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const;
bool canShareStyleWithElement(StyledElement*) const;
@@ -287,16 +282,14 @@
bool checkRegionStyle(Element* regionElement);
- bool usesSiblingRules() const { return !m_ruleSets.features().siblingRules.isEmpty(); }
- bool usesFirstLineRules() const { return m_ruleSets.features().usesFirstLineRules; }
- bool usesBeforeAfterRules() const { return m_ruleSets.features().usesBeforeAfterRules; }
+ bool usesSiblingRules() const { return !m_features.siblingRules.isEmpty(); }
+ bool usesFirstLineRules() const { return m_features.usesFirstLineRules; }
+ bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
void invalidateMatchedPropertiesCache();
void loadPendingShaders();
-#if ENABLE(SVG)
void loadPendingSVGDocuments();
-#endif
void loadPendingResources();
@@ -348,12 +341,13 @@
private:
void matchUARules(ElementRuleCollector&, RuleSet*);
void matchAuthorRules(ElementRuleCollector&, bool includeEmptyRules);
- void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRules, RuleRange&);
- void matchHostRules(ElementRuleCollector&, bool includeEmptyRules);
+ void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRules);
+ void matchHostRules(ScopedStyleResolver*, ElementRuleCollector&, bool includeEmptyRules);
void matchScopedAuthorRules(ElementRuleCollector&, bool includeEmptyRules);
void matchAllRules(ElementRuleCollector&, bool matchAuthorAndUserStyles, bool includeSMILProperties);
void matchUARules(ElementRuleCollector&);
void matchUserRules(ElementRuleCollector&, bool includeEmptyRules);
+ void collectFeatures();
private:
// This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
@@ -432,9 +426,7 @@
void applyProperty(CSSPropertyID, CSSValue*);
-#if ENABLE(SVG)
void applySVGProperty(CSSPropertyID, CSSValue*);
-#endif
PassRefPtr<StyleImage> loadPendingImage(StylePendingImage*);
void loadPendingImages();
@@ -480,8 +472,12 @@
#endif
const DeprecatedStyleBuilder& m_styleBuilder;
+ ScopedStyleTree m_styleTree;
- OwnPtr<ScopedStyleResolver> m_scopeResolver;
+ RuleFeatureSet m_features;
+ OwnPtr<RuleSet> m_siblingRuleSet;
+ OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
+
CSSToStyleMap m_styleMap;
InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
@@ -499,19 +495,19 @@
inline bool StyleResolver::hasSelectorForAttribute(const AtomicString &attributeName) const
{
ASSERT(!attributeName.isEmpty());
- return m_ruleSets.features().attrsInRules.contains(attributeName.impl());
+ return m_features.attrsInRules.contains(attributeName.impl());
}
inline bool StyleResolver::hasSelectorForClass(const AtomicString& classValue) const
{
ASSERT(!classValue.isEmpty());
- return m_ruleSets.features().classesInRules.contains(classValue.impl());
+ return m_features.classesInRules.contains(classValue.impl());
}
inline bool StyleResolver::hasSelectorForId(const AtomicString& idValue) const
{
ASSERT(!idValue.isEmpty());
- return m_ruleSets.features().idsInRules.contains(idValue.impl());
+ return m_features.idsInRules.contains(idValue.impl());
}
inline bool checkRegionSelector(const CSSSelector* regionSelector, Element* regionElement)
diff --git a/Source/core/css/resolver/StyleResolverState.cpp b/Source/core/css/resolver/StyleResolverState.cpp
index 3e3b860..fdeae92 100644
--- a/Source/core/css/resolver/StyleResolverState.cpp
+++ b/Source/core/css/resolver/StyleResolverState.cpp
@@ -51,9 +51,7 @@
m_regionForStyling = 0;
m_pendingImageProperties.clear();
m_hasPendingShaders = false;
-#if ENABLE(SVG)
m_pendingSVGDocuments.clear();
-#endif
}
void StyleResolverState::initElement(Element* e)
diff --git a/Source/core/css/resolver/StyleResolverState.h b/Source/core/css/resolver/StyleResolverState.h
index 4a5aa1c..3920e2a 100644
--- a/Source/core/css/resolver/StyleResolverState.h
+++ b/Source/core/css/resolver/StyleResolverState.h
@@ -25,9 +25,7 @@
#include "CSSPropertyNames.h"
#include "core/css/CSSValueList.h"
-#if ENABLE(SVG)
#include "core/css/WebKitCSSSVGDocumentValue.h"
-#endif
#include "core/dom/Element.h"
#include "core/platform/graphics/Color.h"
#include "core/platform/graphics/filters/FilterOperations.h"
@@ -45,9 +43,7 @@
class StyledElement;
typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
-#if ENABLE(SVG)
typedef HashMap<FilterOperation*, RefPtr<WebKitCSSSVGDocumentValue> > PendingSVGDocumentMap;
-#endif
class StyleResolverState {
WTF_MAKE_NONCOPYABLE(StyleResolverState);
@@ -100,9 +96,7 @@
bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
PendingImagePropertyMap& pendingImageProperties() { return m_pendingImageProperties; }
-#if ENABLE(SVG)
PendingSVGDocumentMap& pendingSVGDocuments() { return m_pendingSVGDocuments; }
-#endif
void setHasPendingShaders(bool hasPendingShaders) { m_hasPendingShaders = hasPendingShaders; }
bool hasPendingShaders() const { return m_hasPendingShaders; }
@@ -152,9 +146,7 @@
PendingImagePropertyMap m_pendingImageProperties;
bool m_hasPendingShaders;
-#if ENABLE(SVG)
PendingSVGDocumentMap m_pendingSVGDocuments;
-#endif
CSSValue* m_lineHeightValue;
bool m_fontDirty;
diff --git a/Source/core/css/resolver/TransformBuilder.cpp b/Source/core/css/resolver/TransformBuilder.cpp
index cd3bd39..e57c8e4 100644
--- a/Source/core/css/resolver/TransformBuilder.cpp
+++ b/Source/core/css/resolver/TransformBuilder.cpp
@@ -30,9 +30,7 @@
#include "core/css/resolver/TransformBuilder.h"
#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/css/WebKitCSSFilterValue.h"
#include "core/css/WebKitCSSTransformValue.h"
-#include "core/platform/graphics/filters/FilterOperation.h"
#include "core/platform/graphics/transforms/Matrix3DTransformOperation.h"
#include "core/platform/graphics/transforms/MatrixTransformOperation.h"
#include "core/platform/graphics/transforms/PerspectiveTransformOperation.h"
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index ac30e8c..36cbf2c 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -61,7 +61,7 @@
return;
if (!m_propertySet) {
- m_propertySet = propertySet->copy();
+ m_propertySet = propertySet->mutableCopy();
return;
}
diff --git a/Source/core/css/resolver/ViewportStyleResolver.h b/Source/core/css/resolver/ViewportStyleResolver.h
index bdbc150..2b1cd82 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.h
+++ b/Source/core/css/resolver/ViewportStyleResolver.h
@@ -41,8 +41,8 @@
class CSSPrimitiveValue;
class Document;
+class MutableStylePropertySet;
class StyleRuleViewport;
-class StylePropertySet;
class ViewportStyleResolver : public RefCounted<ViewportStyleResolver> {
public:
@@ -64,7 +64,7 @@
float getViewportArgumentValue(CSSPropertyID) const;
Document* m_document;
- RefPtr<StylePropertySet> m_propertySet;
+ RefPtr<MutableStylePropertySet> m_propertySet;
};
} // namespace WebCore