summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/css/CSSComputedStyleDeclaration.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/css/CSSComputedStyleDeclaration.cpp')
-rw-r--r--Source/WebCore/css/CSSComputedStyleDeclaration.cpp2905
1 files changed, 1019 insertions, 1886 deletions
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
index 79da5802c..d2e055423 100644
--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Zack Rusin <zack@kde.org>
- * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
* Copyright (C) 2011 Sencha, Inc. All rights reserved.
@@ -28,14 +28,13 @@
#include "AnimationController.h"
#include "BasicShapeFunctions.h"
#include "BasicShapes.h"
-#include "CSSAnimationTriggerScrollValue.h"
#include "CSSAspectRatioValue.h"
#include "CSSBasicShapes.h"
#include "CSSBorderImage.h"
-#include "CSSCustomPropertyValue.h"
#include "CSSFontFeatureValue.h"
#include "CSSFontValue.h"
#include "CSSFunctionValue.h"
+#include "CSSGridTemplateValue.h"
#include "CSSLineBoxContainValue.h"
#include "CSSParser.h"
#include "CSSPrimitiveValue.h"
@@ -57,59 +56,35 @@
#include "Pair.h"
#include "PseudoElement.h"
#include "Rect.h"
-#include "RenderBlock.h"
#include "RenderBox.h"
#include "RenderStyle.h"
+#include "RenderView.h"
#include "SVGElement.h"
#include "StyleInheritedData.h"
#include "StyleProperties.h"
#include "StylePropertyShorthand.h"
#include "StyleResolver.h"
-#include "WebKitCSSFilterValue.h"
#include "WebKitCSSTransformValue.h"
#include "WebKitFontFamilyNames.h"
-#include "WillChangeData.h"
-#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringBuilder.h>
-#if ENABLE(CSS_GRID_LAYOUT)
-#include "CSSGridLineNamesValue.h"
-#include "CSSGridTemplateAreasValue.h"
-#include "RenderGrid.h"
-#endif
-
#if ENABLE(CSS_SHAPES)
#include "ShapeValue.h"
#endif
-#if ENABLE(DASHBOARD_SUPPORT)
-#include "DashboardRegion.h"
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
-#include "LengthRepeat.h"
-#include "StyleScrollSnapPoints.h"
+#if ENABLE(CSS_FILTERS)
+#include "WebKitCSSFilterValue.h"
#endif
-#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-#include "AnimationTrigger.h"
+#if ENABLE(DASHBOARD_SUPPORT)
+#include "DashboardRegion.h"
#endif
namespace WebCore {
// List of all properties we know how to compute, omitting shorthands.
static const CSSPropertyID computedProperties[] = {
- CSSPropertyAlt,
- CSSPropertyAnimationDelay,
- CSSPropertyAnimationDirection,
- CSSPropertyAnimationDuration,
- CSSPropertyAnimationFillMode,
- CSSPropertyAnimationIterationCount,
- CSSPropertyAnimationName,
- CSSPropertyAnimationPlayState,
- CSSPropertyAnimationTimingFunction,
CSSPropertyBackgroundAttachment,
- CSSPropertyBackgroundBlendMode,
CSSPropertyBackgroundClip,
CSSPropertyBackgroundColor,
CSSPropertyBackgroundImage,
@@ -146,7 +121,6 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyClear,
CSSPropertyClip,
CSSPropertyColor,
- CSSPropertyContent,
CSSPropertyCursor,
CSSPropertyDirection,
CSSPropertyDisplay,
@@ -155,7 +129,6 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyFontFamily,
CSSPropertyFontSize,
CSSPropertyFontStyle,
- CSSPropertyFontSynthesis,
CSSPropertyFontVariant,
CSSPropertyFontWeight,
CSSPropertyHeight,
@@ -220,9 +193,6 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyTextOverflow,
CSSPropertyTextTransform,
CSSPropertyTop,
- CSSPropertyTransform,
- CSSPropertyTransformOrigin,
- CSSPropertyTransformStyle,
CSSPropertyTransitionDelay,
CSSPropertyTransitionDuration,
CSSPropertyTransitionProperty,
@@ -236,15 +206,10 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWordBreak,
CSSPropertyWordSpacing,
CSSPropertyWordWrap,
-#if ENABLE(CSS_SCROLL_SNAP)
- CSSPropertyWebkitScrollSnapType,
- CSSPropertyWebkitScrollSnapPointsX,
- CSSPropertyWebkitScrollSnapPointsY,
- CSSPropertyWebkitScrollSnapDestination,
- CSSPropertyWebkitScrollSnapCoordinate,
-#endif
CSSPropertyZIndex,
CSSPropertyZoom,
+
+ CSSPropertyWebkitAlt,
CSSPropertyWebkitAnimationDelay,
CSSPropertyWebkitAnimationDirection,
CSSPropertyWebkitAnimationDuration,
@@ -253,18 +218,15 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitAnimationName,
CSSPropertyWebkitAnimationPlayState,
CSSPropertyWebkitAnimationTimingFunction,
-#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
- CSSPropertyWebkitAnimationTrigger,
-#endif
CSSPropertyWebkitAppearance,
CSSPropertyWebkitBackfaceVisibility,
+ CSSPropertyWebkitBackgroundBlendMode,
CSSPropertyWebkitBackgroundClip,
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitBackgroundOrigin,
CSSPropertyWebkitBackgroundSize,
#if ENABLE(CSS_COMPOSITING)
- CSSPropertyMixBlendMode,
- CSSPropertyIsolation,
+ CSSPropertyWebkitBlendMode,
#endif
CSSPropertyWebkitBorderFit,
CSSPropertyWebkitBorderHorizontalSpacing,
@@ -284,68 +246,55 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitBoxReflect,
CSSPropertyWebkitBoxShadow,
CSSPropertyWebkitClipPath,
+ CSSPropertyWebkitColorCorrection,
CSSPropertyWebkitColumnBreakAfter,
CSSPropertyWebkitColumnBreakBefore,
CSSPropertyWebkitColumnBreakInside,
CSSPropertyWebkitColumnAxis,
- CSSPropertyColumnCount,
- CSSPropertyColumnFill,
- CSSPropertyColumnGap,
- CSSPropertyColumnProgression,
- CSSPropertyColumnRuleColor,
- CSSPropertyColumnRuleStyle,
- CSSPropertyColumnRuleWidth,
- CSSPropertyColumnSpan,
- CSSPropertyColumnWidth,
+ CSSPropertyWebkitColumnCount,
+ CSSPropertyWebkitColumnGap,
+ CSSPropertyWebkitColumnProgression,
+ CSSPropertyWebkitColumnRuleColor,
+ CSSPropertyWebkitColumnRuleStyle,
+ CSSPropertyWebkitColumnRuleWidth,
+ CSSPropertyWebkitColumnSpan,
+ CSSPropertyWebkitColumnWidth,
#if ENABLE(CURSOR_VISIBILITY)
CSSPropertyWebkitCursorVisibility,
#endif
#if ENABLE(DASHBOARD_SUPPORT)
CSSPropertyWebkitDashboardRegion,
#endif
- CSSPropertyAlignContent,
- CSSPropertyAlignItems,
- CSSPropertyAlignSelf,
- CSSPropertyFilter,
- CSSPropertyFlexBasis,
- CSSPropertyFlexGrow,
- CSSPropertyFlexShrink,
- CSSPropertyFlexDirection,
- CSSPropertyFlexWrap,
- CSSPropertyJustifyContent,
- CSSPropertyJustifySelf,
- CSSPropertyJustifyItems,
-#if ENABLE(FILTERS_LEVEL_2)
- CSSPropertyWebkitBackdropFilter,
+#if ENABLE(CSS_FILTERS)
+ CSSPropertyWebkitFilter,
#endif
+ CSSPropertyWebkitAlignContent,
+ CSSPropertyWebkitAlignItems,
+ CSSPropertyWebkitAlignSelf,
+ CSSPropertyWebkitFlexBasis,
+ CSSPropertyWebkitFlexGrow,
+ CSSPropertyWebkitFlexShrink,
+ CSSPropertyWebkitFlexDirection,
+ CSSPropertyWebkitFlexWrap,
+ CSSPropertyWebkitJustifyContent,
CSSPropertyWebkitFontKerning,
CSSPropertyWebkitFontSmoothing,
- CSSPropertyFontVariantLigatures,
- CSSPropertyFontVariantPosition,
- CSSPropertyFontVariantCaps,
- CSSPropertyFontVariantNumeric,
- CSSPropertyFontVariantAlternates,
- CSSPropertyFontVariantEastAsian,
-#if ENABLE(CSS_GRID_LAYOUT)
+ CSSPropertyWebkitFontVariantLigatures,
CSSPropertyWebkitGridAutoColumns,
CSSPropertyWebkitGridAutoFlow,
CSSPropertyWebkitGridAutoRows,
CSSPropertyWebkitGridColumnEnd,
CSSPropertyWebkitGridColumnStart,
- CSSPropertyWebkitGridTemplateAreas,
- CSSPropertyWebkitGridTemplateColumns,
- CSSPropertyWebkitGridTemplateRows,
+ CSSPropertyWebkitGridDefinitionColumns,
+ CSSPropertyWebkitGridDefinitionRows,
CSSPropertyWebkitGridRowEnd,
CSSPropertyWebkitGridRowStart,
- CSSPropertyWebkitGridColumnGap,
- CSSPropertyWebkitGridRowGap,
-#endif
+ CSSPropertyWebkitHighlight,
CSSPropertyWebkitHyphenateCharacter,
CSSPropertyWebkitHyphenateLimitAfter,
CSSPropertyWebkitHyphenateLimitBefore,
CSSPropertyWebkitHyphenateLimitLines,
CSSPropertyWebkitHyphens,
- CSSPropertyWebkitInitialLetter,
CSSPropertyWebkitLineAlign,
CSSPropertyWebkitLineBoxContain,
CSSPropertyWebkitLineBreak,
@@ -374,18 +323,23 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitMaskSize,
CSSPropertyWebkitMaskSourceType,
CSSPropertyWebkitNbspMode,
- CSSPropertyOrder,
+ CSSPropertyWebkitOrder,
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
CSSPropertyWebkitOverflowScrolling,
#endif
- CSSPropertyPerspective,
- CSSPropertyPerspectiveOrigin,
+ CSSPropertyWebkitPerspective,
+ CSSPropertyWebkitPerspectiveOrigin,
CSSPropertyWebkitPrintColorAdjust,
CSSPropertyWebkitRtlOrdering,
#if PLATFORM(IOS)
CSSPropertyWebkitTouchCallout,
+
+ // FIXME: This property shouldn't be iOS-specific. Once we fix up its usage in InlineTextBox::paintCompositionBackground()
+ // we should move it outside the PLATFORM(IOS)-guard. See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
+ CSSPropertyWebkitCompositionFillColor,
#endif
#if ENABLE(CSS_SHAPES)
+ CSSPropertyWebkitShapeInside,
CSSPropertyWebkitShapeOutside,
#endif
#if ENABLE(TOUCH_EVENTS)
@@ -404,7 +358,8 @@ static const CSSPropertyID computedProperties[] = {
#endif
CSSPropertyWebkitTextStrokeColor,
CSSPropertyWebkitTextStrokeWidth,
- CSSPropertyWebkitTextZoom,
+ CSSPropertyWebkitTransform,
+ CSSPropertyWebkitTransformOrigin,
CSSPropertyWebkitTransformStyle,
CSSPropertyWebkitTransitionDelay,
CSSPropertyWebkitTransitionDuration,
@@ -422,15 +377,19 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitRegionBreakInside,
CSSPropertyWebkitRegionFragment,
#endif
+#if ENABLE(CSS_EXCLUSIONS)
+ CSSPropertyWebkitWrapFlow,
+ CSSPropertyWebkitWrapThrough,
+#endif
#if ENABLE(CSS_SHAPES)
CSSPropertyWebkitShapeMargin,
+ CSSPropertyWebkitShapePadding,
CSSPropertyWebkitShapeImageThreshold,
#endif
+#if ENABLE(SVG)
CSSPropertyBufferedRendering,
CSSPropertyClipPath,
CSSPropertyClipRule,
- CSSPropertyCx,
- CSSPropertyCy,
CSSPropertyMask,
CSSPropertyFilter,
CSSPropertyFloodColor,
@@ -448,10 +407,6 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyMarkerMid,
CSSPropertyMarkerStart,
CSSPropertyMaskType,
- CSSPropertyPaintOrder,
- CSSPropertyR,
- CSSPropertyRx,
- CSSPropertyRy,
CSSPropertyShapeRendering,
CSSPropertyStroke,
CSSPropertyStrokeDasharray,
@@ -470,9 +425,8 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyGlyphOrientationHorizontal,
CSSPropertyGlyphOrientationVertical,
CSSPropertyWebkitSvgShadow,
- CSSPropertyVectorEffect,
- CSSPropertyX,
- CSSPropertyY
+ CSSPropertyVectorEffect
+#endif
};
const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties);
@@ -491,74 +445,71 @@ static CSSValueID valueForRepeatRule(int rule)
}
}
-static Ref<CSSPrimitiveValue> valueForImageSliceSide(const Length& length)
-{
- // These values can be percentages, numbers, or while an animation of mixed types is in progress,
- // a calculation that combines a percentage and a number.
- if (length.isPercent())
- return CSSValuePool::singleton().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
- if (length.isFixed())
- return CSSValuePool::singleton().createValue(length.value(), CSSPrimitiveValue::CSS_NUMBER);
-
- // Calculating the actual length currently in use would require most of the code from RenderBoxModelObject::paintNinePieceImage.
- // And even if we could do that, it's not clear if that's exactly what we'd want during animation.
- // FIXME: For now, just return 0.
- ASSERT(length.isCalculated());
- return CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::CSS_NUMBER);
-}
-
-static Ref<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
+static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
{
- auto& slices = image.imageSlices();
-
- RefPtr<CSSPrimitiveValue> top = valueForImageSliceSide(slices.top());
-
+ // Create the slices.
+ RefPtr<CSSPrimitiveValue> top;
RefPtr<CSSPrimitiveValue> right;
RefPtr<CSSPrimitiveValue> bottom;
RefPtr<CSSPrimitiveValue> left;
- if (slices.right() == slices.top() && slices.bottom() == slices.top() && slices.left() == slices.top()) {
+ if (image.imageSlices().top().isPercent())
+ top = cssValuePool().createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ else
+ top = cssValuePool().createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_NUMBER);
+
+ if (image.imageSlices().right() == image.imageSlices().top() && image.imageSlices().bottom() == image.imageSlices().top()
+ && image.imageSlices().left() == image.imageSlices().top()) {
right = top;
bottom = top;
left = top;
} else {
- right = valueForImageSliceSide(slices.right());
+ if (image.imageSlices().right().isPercent())
+ right = cssValuePool().createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ else
+ right = cssValuePool().createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_NUMBER);
- if (slices.bottom() == slices.top() && slices.right() == slices.left()) {
+ if (image.imageSlices().bottom() == image.imageSlices().top() && image.imageSlices().right() == image.imageSlices().left()) {
bottom = top;
left = right;
} else {
- bottom = valueForImageSliceSide(slices.bottom());
+ if (image.imageSlices().bottom().isPercent())
+ bottom = cssValuePool().createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ else
+ bottom = cssValuePool().createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
- if (slices.left() == slices.right())
+ if (image.imageSlices().left() == image.imageSlices().right())
left = right;
- else
- left = valueForImageSliceSide(slices.left());
+ else {
+ if (image.imageSlices().left().isPercent())
+ left = cssValuePool().createValue(image.imageSlices().left().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ else
+ left = cssValuePool().createValue(image.imageSlices().left().value(), CSSPrimitiveValue::CSS_NUMBER);
+ }
}
}
- auto quad = Quad::create();
- quad->setTop(top.release());
- quad->setRight(right.release());
- quad->setBottom(bottom.release());
- quad->setLeft(left.release());
+ RefPtr<Quad> quad = Quad::create();
+ quad->setTop(top);
+ quad->setRight(right);
+ quad->setBottom(bottom);
+ quad->setLeft(left);
- return CSSBorderImageSliceValue::create(CSSValuePool::singleton().createValue(WTFMove(quad)), image.fill());
+ return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.release()), image.fill());
}
-static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
+static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
{
+ // Create the slices.
RefPtr<CSSPrimitiveValue> top;
RefPtr<CSSPrimitiveValue> right;
RefPtr<CSSPrimitiveValue> bottom;
RefPtr<CSSPrimitiveValue> left;
- auto& cssValuePool = CSSValuePool::singleton();
-
if (box.top().isRelative())
- top = cssValuePool.createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
+ top = cssValuePool().createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
else
- top = cssValuePool.createValue(box.top());
+ top = cssValuePool().createValue(box.top());
if (box.right() == box.top() && box.bottom() == box.top() && box.left() == box.top()) {
right = top;
@@ -566,56 +517,56 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
left = top;
} else {
if (box.right().isRelative())
- right = cssValuePool.createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
+ right = cssValuePool().createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
else
- right = cssValuePool.createValue(box.right());
+ right = cssValuePool().createValue(box.right());
if (box.bottom() == box.top() && box.right() == box.left()) {
bottom = top;
left = right;
} else {
if (box.bottom().isRelative())
- bottom = cssValuePool.createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
+ bottom = cssValuePool().createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
else
- bottom = cssValuePool.createValue(box.bottom());
+ bottom = cssValuePool().createValue(box.bottom());
if (box.left() == box.right())
left = right;
else {
if (box.left().isRelative())
- left = cssValuePool.createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
+ left = cssValuePool().createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
else
- left = cssValuePool.createValue(box.left());
+ left = cssValuePool().createValue(box.left());
}
}
}
- auto quad = Quad::create();
+ RefPtr<Quad> quad = Quad::create();
quad->setTop(top);
quad->setRight(right);
quad->setBottom(bottom);
quad->setLeft(left);
- return cssValuePool.createValue(WTFMove(quad));
+ return cssValuePool().createValue(quad.release());
}
-static Ref<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
+static PassRef<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
{
- auto& cssValuePool = CSSValuePool::singleton();
- RefPtr<CSSPrimitiveValue> horizontalRepeat = cssValuePool.createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
-
+ RefPtr<CSSPrimitiveValue> horizontalRepeat;
RefPtr<CSSPrimitiveValue> verticalRepeat;
+
+ horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
if (image.horizontalRule() == image.verticalRule())
verticalRepeat = horizontalRepeat;
else
- verticalRepeat = cssValuePool.createIdentifierValue(valueForRepeatRule(image.verticalRule()));
- return cssValuePool.createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release()));
+ verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.verticalRule()));
+ return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release()));
}
-static Ref<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
+static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
{
if (!image.hasImage())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
// Image first.
RefPtr<CSSValue> imageValue;
@@ -637,290 +588,284 @@ static Ref<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
return createBorderImageValue(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat.release());
}
-inline static Ref<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle& style)
+inline static PassRef<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle* style)
{
- return CSSValuePool::singleton().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
+ return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
}
-inline static Ref<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle& style)
+inline static PassRef<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
{
- return CSSValuePool::singleton().createValue(value / style.effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
}
-static Ref<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle& style)
+static PassRef<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style)
{
if (length.isFixed())
return zoomAdjustedPixelValue(length.value(), style);
- return CSSValuePool::singleton().createValue(length, style);
+ return cssValuePool().createValue(length);
}
-static Ref<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle& style)
+static PassRef<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
{
if (!reflection)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
RefPtr<CSSPrimitiveValue> offset;
- if (reflection->offset().isPercentOrCalculated())
- offset = CSSValuePool::singleton().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ if (reflection->offset().isPercent())
+ offset = cssValuePool().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
RefPtr<CSSPrimitiveValue> direction;
switch (reflection->direction()) {
case ReflectionBelow:
- direction = CSSValuePool::singleton().createIdentifierValue(CSSValueBelow);
+ direction = cssValuePool().createIdentifierValue(CSSValueBelow);
break;
case ReflectionAbove:
- direction = CSSValuePool::singleton().createIdentifierValue(CSSValueAbove);
+ direction = cssValuePool().createIdentifierValue(CSSValueAbove);
break;
case ReflectionLeft:
- direction = CSSValuePool::singleton().createIdentifierValue(CSSValueLeft);
+ direction = cssValuePool().createIdentifierValue(CSSValueLeft);
break;
case ReflectionRight:
- direction = CSSValuePool::singleton().createIdentifierValue(CSSValueRight);
+ direction = cssValuePool().createIdentifierValue(CSSValueRight);
break;
}
return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask()));
}
-static Ref<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle& style)
+static PassRef<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle* style)
{
auto positionList = CSSValueList::createSpaceSeparated();
if (layer->isBackgroundOriginSet()) {
ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
- positionList.get().append(CSSValuePool::singleton().createValue(layer->backgroundXOrigin()));
+ positionList.get().append(cssValuePool().createValue(layer->backgroundXOrigin()));
}
positionList.get().append(zoomAdjustedPixelValueForLength(layer->xPosition(), style));
if (layer->isBackgroundOriginSet()) {
ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
- positionList.get().append(CSSValuePool::singleton().createValue(layer->backgroundYOrigin()));
+ positionList.get().append(cssValuePool().createValue(layer->backgroundYOrigin()));
}
positionList.get().append(zoomAdjustedPixelValueForLength(layer->yPosition(), style));
return positionList;
}
-static RefPtr<CSSValue> positionOffsetValue(RenderStyle& style, CSSPropertyID propertyID)
+static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, RenderView* renderView)
{
- Length length;
+ if (!style)
+ return 0;
+
+ Length l;
switch (propertyID) {
case CSSPropertyLeft:
- length = style.left();
+ l = style->left();
break;
case CSSPropertyRight:
- length = style.right();
+ l = style->right();
break;
case CSSPropertyTop:
- length = style.top();
+ l = style->top();
break;
case CSSPropertyBottom:
- length = style.bottom();
+ l = style->bottom();
break;
default:
- return nullptr;
+ return 0;
}
- if (style.hasOutOfFlowPosition()) {
- if (length.isFixed())
- return zoomAdjustedPixelValue(length.value(), style);
-
- return CSSValuePool::singleton().createValue(length);
+ if (style->hasOutOfFlowPosition()) {
+ if (l.type() == WebCore::Fixed)
+ return zoomAdjustedPixelValue(l.value(), style);
+ else if (l.isViewportPercentage())
+ return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
+ return cssValuePool().createValue(l);
}
- if (style.hasInFlowPosition()) {
+ if (style->hasInFlowPosition()) {
// FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
// In other words if left is auto and right is not auto, then left's computed value is negative right().
// So we should get the opposite length unit and see if it is auto.
- return CSSValuePool::singleton().createValue(length);
+ return cssValuePool().createValue(l);
}
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
}
-RefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(RenderStyle* style, const Color& color) const
+PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(RenderStyle* style, const Color& color) const
{
// This function does NOT look at visited information, so that computed style doesn't expose that.
if (!color.isValid())
- return CSSValuePool::singleton().createColorValue(style->color().rgb());
- return CSSValuePool::singleton().createColorValue(color.rgb());
-}
-
-static Ref<CSSPrimitiveValue> percentageOrZoomAdjustedValue(Length length, const RenderStyle& style)
-{
- if (length.isPercent())
- return CSSValuePool::singleton().createValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
-
- return zoomAdjustedPixelValue(valueForLength(length, 0), style);
+ return cssValuePool().createColorValue(style->color().rgb());
+ return cssValuePool().createColorValue(color.rgb());
}
-static Ref<CSSPrimitiveValue> autoOrZoomAdjustedValue(Length length, const RenderStyle& style)
-{
- if (length.isAuto())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
-
- return zoomAdjustedPixelValue(valueForLength(length, 0), style);
-}
-
-static Ref<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle& style)
+static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
{
auto list = CSSValueList::createSpaceSeparated();
- list.get().append(percentageOrZoomAdjustedValue(radius.width(), style));
- list.get().append(percentageOrZoomAdjustedValue(radius.height(), style));
+ if (radius.width().type() == Percent)
+ list.get().append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+ else
+ list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
+ if (radius.height().type() == Percent)
+ list.get().append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+ else
+ list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
return list;
}
-static Ref<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle& style)
+static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
{
- if (radius.width() == radius.height())
- return percentageOrZoomAdjustedValue(radius.width(), style);
-
- return getBorderRadiusCornerValues(radius, style);
+ if (radius.width() == radius.height()) {
+ if (radius.width().type() == Percent)
+ return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
+ }
+ return getBorderRadiusCornerValues(radius, style, renderView);
}
-static Ref<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle& style)
+static PassRef<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
{
auto list = CSSValueList::createSlashSeparated();
- bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != style.borderBottomLeftRadius().width();
- bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBottomRightRadius().width() != style.borderTopLeftRadius().width());
- bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopRightRadius().width() != style.borderTopLeftRadius().width());
+ bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
+ bool showHorizontalBottomRight = showHorizontalBottomLeft || (style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width());
+ bool showHorizontalTopRight = showHorizontalBottomRight || (style->borderTopRightRadius().width() != style->borderTopLeftRadius().width());
- bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style.borderBottomLeftRadius().height();
- bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottomRightRadius().height() != style.borderTopLeftRadius().height());
- bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRightRadius().height() != style.borderTopLeftRadius().height());
+ bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height();
+ bool showVerticalBottomRight = showVerticalBottomLeft || (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height());
+ bool showVerticalTopRight = showVerticalBottomRight || (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height());
- RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style.borderTopLeftRadius(), style);
- RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style.borderTopRightRadius(), style);
- RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style.borderBottomRightRadius(), style);
- RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style.borderBottomLeftRadius(), style);
+ RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
+ RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
+ RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
+ RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
- horizontalRadii->append(*topLeftRadius->item(0));
+ horizontalRadii->append(topLeftRadius->item(0));
if (showHorizontalTopRight)
- horizontalRadii->append(*topRightRadius->item(0));
+ horizontalRadii->append(topRightRadius->item(0));
if (showHorizontalBottomRight)
- horizontalRadii->append(*bottomRightRadius->item(0));
+ horizontalRadii->append(bottomRightRadius->item(0));
if (showHorizontalBottomLeft)
- horizontalRadii->append(*bottomLeftRadius->item(0));
+ horizontalRadii->append(bottomLeftRadius->item(0));
- list.get().append(horizontalRadii.releaseNonNull());
+ list.get().append(horizontalRadii.release());
RefPtr<CSSValueList> verticalRadiiList = CSSValueList::createSpaceSeparated();
- verticalRadiiList->append(*topLeftRadius->item(1));
+ verticalRadiiList->append(topLeftRadius->item(1));
if (showVerticalTopRight)
- verticalRadiiList->append(*topRightRadius->item(1));
+ verticalRadiiList->append(topRightRadius->item(1));
if (showVerticalBottomRight)
- verticalRadiiList->append(*bottomRightRadius->item(1));
+ verticalRadiiList->append(bottomRightRadius->item(1));
if (showVerticalBottomLeft)
- verticalRadiiList->append(*bottomLeftRadius->item(1));
+ verticalRadiiList->append(bottomLeftRadius->item(1));
- if (!verticalRadiiList->equals(downcast<CSSValueList>(*list.get().item(0))))
- list.get().append(verticalRadiiList.releaseNonNull());
+ if (!verticalRadiiList->equals(*toCSSValueList(list.get().item(0))))
+ list.get().append(verticalRadiiList.release());
return list;
}
-static LayoutRect sizingBox(RenderObject& renderer)
+static LayoutRect sizingBox(RenderObject* renderer)
{
- if (!is<RenderBox>(renderer))
+ if (!renderer->isBox())
return LayoutRect();
- auto& box = downcast<RenderBox>(renderer);
- return box.style().boxSizing() == BORDER_BOX ? box.borderBoxRect() : box.computedCSSContentBoxRect();
+ RenderBox* box = toRenderBox(renderer);
+ return box->style().boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
}
-static Ref<WebKitCSSTransformValue> matrixTransformValue(const TransformationMatrix& transform, const RenderStyle& style)
+static PassRef<WebKitCSSTransformValue> matrixTransformValue(const TransformationMatrix& transform, const RenderStyle* style)
{
RefPtr<WebKitCSSTransformValue> transformValue;
- auto& cssValuePool = CSSValuePool::singleton();
if (transform.isAffine()) {
transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
- transformValue->append(cssValuePool.createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
} else {
transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
- transformValue->append(cssValuePool.createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
- transformValue->append(cssValuePool.createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
- transformValue->append(cssValuePool.createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
+ transformValue->append(cssValuePool().createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
}
return transformValue.releaseNonNull();
}
-static Ref<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle& style)
+static PassRef<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style)
{
- if (!renderer || !renderer->hasTransform())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ if (!renderer || !renderer->hasTransform() || !style->hasTransform())
+ return cssValuePool().createIdentifierValue(CSSValueNone);
- FloatRect pixelSnappedRect;
- if (is<RenderBox>(*renderer))
- pixelSnappedRect = snapRectToDevicePixels(downcast<RenderBox>(*renderer).borderBoxRect(), renderer->document().deviceScaleFactor());
+ IntRect box;
+ if (renderer->isBox())
+ box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect());
TransformationMatrix transform;
- style.applyTransform(transform, pixelSnappedRect, RenderStyle::ExcludeTransformOrigin);
- // Note that this does not flatten to an affine transform if ENABLE(3D_TRANSFORMS) is off, by design.
+ style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
+ // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
// FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
auto list = CSSValueList::createSpaceSeparated();
list.get().append(matrixTransformValue(transform, style));
- return WTFMove(list);
+ return std::move(list);
}
-static inline Ref<CSSPrimitiveValue> adjustLengthForZoom(double length, const RenderStyle& style, AdjustPixelValuesForComputedStyle adjust)
+static inline PassRef<CSSPrimitiveValue> adjustLengthForZoom(double length, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
{
- return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length, style) : CSSValuePool::singleton().createValue(length, CSSPrimitiveValue::CSS_PX);
+ return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length, style) : cssValuePool().createValue(length, CSSPrimitiveValue::CSS_PX);
}
-static inline Ref<CSSPrimitiveValue> adjustLengthForZoom(const Length& length, const RenderStyle& style, AdjustPixelValuesForComputedStyle adjust)
+static inline PassRef<CSSPrimitiveValue> adjustLengthForZoom(const Length& length, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
{
- return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length.value(), style) : CSSValuePool::singleton().createValue(length);
+ return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length.value(), style) : cssValuePool().createValue(length);
}
-Ref<CSSValue> ComputedStyleExtractor::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle& style, AdjustPixelValuesForComputedStyle adjust)
+PassRefPtr<CSSValue> ComputedStyleExtractor::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
{
- auto& cssValuePool = CSSValuePool::singleton();
if (!shadow)
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
- auto list = CSSValueList::createCommaSeparated();
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const ShadowData* currShadowData = shadow; currShadowData; currShadowData = currShadowData->next()) {
RefPtr<CSSPrimitiveValue> x = adjustLengthForZoom(currShadowData->x(), style, adjust);
RefPtr<CSSPrimitiveValue> y = adjustLengthForZoom(currShadowData->y(), style, adjust);
RefPtr<CSSPrimitiveValue> blur = adjustLengthForZoom(currShadowData->radius(), style, adjust);
RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : adjustLengthForZoom(currShadowData->spread(), style, adjust);
- RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || currShadowData->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool.createIdentifierValue(CSSValueInset);
- RefPtr<CSSPrimitiveValue> color = cssValuePool.createColorValue(currShadowData->color().rgb());
- list.get().prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
+ RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || currShadowData->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
+ RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(currShadowData->color().rgb());
+ list->prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
}
- return WTFMove(list);
+ return list.release();
}
-Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
+#if ENABLE(CSS_FILTERS)
+PassRef<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
{
- auto& cssValuePool = CSSValuePool::singleton();
if (filterOperations.operations().isEmpty())
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
auto list = CSSValueList::createSpaceSeparated();
@@ -928,73 +873,73 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
Vector<RefPtr<FilterOperation>>::const_iterator end = filterOperations.operations().end();
for (Vector<RefPtr<FilterOperation>>::const_iterator it = filterOperations.operations().begin(); it != end; ++it) {
- FilterOperation& filterOperation = **it;
- switch (filterOperation.type()) {
+ FilterOperation* filterOperation = (*it).get();
+ switch (filterOperation->type()) {
case FilterOperation::REFERENCE: {
- ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
+ ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
- filterValue->append(cssValuePool.createValue(referenceOperation.url(), CSSPrimitiveValue::CSS_URI));
+ filterValue->append(cssValuePool().createValue(referenceOperation->url(), CSSPrimitiveValue::CSS_URI));
break;
}
case FilterOperation::GRAYSCALE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::GrayscaleFilterOperation);
- filterValue->append(cssValuePool.createValue(colorMatrixOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::SEPIA: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::SepiaFilterOperation);
- filterValue->append(cssValuePool.createValue(colorMatrixOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::SATURATE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::SaturateFilterOperation);
- filterValue->append(cssValuePool.createValue(colorMatrixOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::HUE_ROTATE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::HueRotateFilterOperation);
- filterValue->append(cssValuePool.createValue(colorMatrixOperation.amount(), CSSPrimitiveValue::CSS_DEG));
+ filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_DEG));
break;
}
case FilterOperation::INVERT: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::InvertFilterOperation);
- filterValue->append(cssValuePool.createValue(componentTransferOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::OPACITY: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::OpacityFilterOperation);
- filterValue->append(cssValuePool.createValue(componentTransferOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::BRIGHTNESS: {
- BasicComponentTransferFilterOperation& brightnessOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation* brightnessOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::BrightnessFilterOperation);
- filterValue->append(cssValuePool.createValue(brightnessOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(brightnessOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::CONTRAST: {
- BasicComponentTransferFilterOperation& contrastOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation* contrastOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ContrastFilterOperation);
- filterValue->append(cssValuePool.createValue(contrastOperation.amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(contrastOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
}
case FilterOperation::BLUR: {
- BlurFilterOperation& blurOperation = downcast<BlurFilterOperation>(filterOperation);
+ BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::BlurFilterOperation);
- filterValue->append(adjustLengthForZoom(blurOperation.stdDeviation(), style, adjust));
+ filterValue->append(adjustLengthForZoom(blurOperation->stdDeviation(), style, adjust));
break;
}
case FilterOperation::DROP_SHADOW: {
- DropShadowFilterOperation& dropShadowOperation = downcast<DropShadowFilterOperation>(filterOperation);
+ DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::DropShadowFilterOperation);
// We want our computed style to look like that of a text shadow (has neither spread nor inset style).
- ShadowData shadowData = ShadowData(dropShadowOperation.location(), dropShadowOperation.stdDeviation(), 0, Normal, false, dropShadowOperation.color());
+ ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style, adjust));
break;
}
@@ -1002,429 +947,144 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::UnknownFilterOperation);
break;
}
- list.get().append(filterValue.releaseNonNull());
+ list.get().append(filterValue.release());
}
- return WTFMove(list);
+ return std::move(list);
}
+#endif
-#if ENABLE(CSS_GRID_LAYOUT)
-static Ref<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle& style)
+static PassRef<CSSValue> valueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
{
if (!trackBreadth.isLength())
- return CSSValuePool::singleton().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
+ return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
const Length& trackBreadthLength = trackBreadth.length();
if (trackBreadthLength.isAuto())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ if (trackBreadthLength.isViewportPercentage())
+ return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
}
-static Ref<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle& style)
+static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
{
switch (trackSize.type()) {
case LengthTrackSizing:
- return specifiedValueForGridTrackBreadth(trackSize.length(), style);
- default:
- ASSERT(trackSize.type() == MinMaxTrackSizing);
+ return valueForGridTrackBreadth(trackSize.length(), style, renderView);
+ case MinMaxTrackSizing:
RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
- minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
- minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style));
+ minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
+ minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
}
+ ASSERT_NOT_REACHED();
+ return 0;
}
-static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLinesMap& orderedNamedGridLines, size_t i, CSSValueList& list)
+static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMap& namedGridLines, size_t i, CSSValueList& list)
{
- const Vector<String>& namedGridLines = orderedNamedGridLines.get(i);
- if (namedGridLines.isEmpty())
- return;
+ // Note that this won't return the results in the order specified in the style sheet,
+ // which is probably fine as we still *do* return all the expected values.
+ NamedGridLinesMap::const_iterator it = namedGridLines.begin();
+ NamedGridLinesMap::const_iterator end = namedGridLines.end();
+ for (; it != end; ++it) {
+ const Vector<size_t>& linesIndexes = it->value;
+ for (size_t j = 0; j < linesIndexes.size(); ++j) {
+ if (linesIndexes[j] != i)
+ continue;
- auto& cssValuePool = CSSValuePool::singleton();
- RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
- for (auto& name : namedGridLines)
- lineNames->append(cssValuePool.createValue(name, CSSPrimitiveValue::CSS_STRING));
- list.append(lineNames.releaseNonNull());
+ list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
+ break;
+ }
+ }
}
-static Ref<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle& style)
+static PassRef<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const NamedGridLinesMap& namedGridLines, const RenderStyle* style, RenderView* renderView)
{
- const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gridColumns() : style.gridRows();
- const OrderedNamedGridLinesMap& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
- bool isRenderGrid = is<RenderGrid>(renderer);
-
- // Handle the 'none' case.
- bool trackListIsEmpty = trackSizes.isEmpty();
- if (isRenderGrid && trackListIsEmpty) {
- // For grids we should consider every listed track, whether implicitly or explicitly created. If we don't have
- // any explicit track and there are no children then there are no implicit tracks. We cannot simply check the
- // number of rows/columns in our internal grid representation because it's always at least 1x1 (see r143331).
- trackListIsEmpty = !downcast<RenderBlock>(*renderer).firstChild();
- }
-
- if (trackListIsEmpty) {
- ASSERT(orderedNamedGridLines.isEmpty());
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ // Handle the 'none' case here.
+ if (!trackSizes.size()) {
+ ASSERT(namedGridLines.isEmpty());
+ return cssValuePool().createIdentifierValue(CSSValueNone);
}
auto list = CSSValueList::createSpaceSeparated();
- unsigned insertionIndex;
- if (isRenderGrid) {
- const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? downcast<RenderGrid>(*renderer).columnPositions() : downcast<RenderGrid>(*renderer).rowPositions();
- // There are at least #tracks + 1 grid lines (trackPositions). Apart from that, the grid container can generate implicit grid tracks,
- // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
- ASSERT(trackPositions.size() - 1 >= trackSizes.size());
-
- unsigned i = 0;
- LayoutUnit gutterSize = downcast<RenderGrid>(*renderer).guttersSize(direction, 2);
- for (; i < trackPositions.size() - 2; ++i) {
- addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, list.get());
- list.get().append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositions[i] - gutterSize, style));
- }
- // Last track line does not have any gutter.
- addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, list.get());
- list.get().append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositions[i], style));
- insertionIndex = trackPositions.size() - 1;
- } else {
- for (unsigned i = 0; i < trackSizes.size(); ++i) {
- addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, list.get());
- list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style));
- }
- insertionIndex = trackSizes.size();
+ for (size_t i = 0; i < trackSizes.size(); ++i) {
+ addValuesForNamedGridLinesAtIndex(namedGridLines, i, list.get());
+ list.get().append(valueForGridTrackSize(trackSizes[i], style, renderView));
}
-
- // Those are the trailing <ident>* allowed in the syntax.
- addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, list.get());
- return WTFMove(list);
+ // Those are the trailing <string>* allowed in the syntax.
+ addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), list.get());
+ return std::move(list);
}
-static Ref<CSSValue> valueForGridPosition(const GridPosition& position)
+static PassRef<CSSValue> valueForGridPosition(const GridPosition& position)
{
- auto& cssValuePool = CSSValuePool::singleton();
if (position.isAuto())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
if (position.isNamedGridArea())
- return cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING);
auto list = CSSValueList::createSpaceSeparated();
if (position.isSpan()) {
- list.get().append(cssValuePool.createIdentifierValue(CSSValueSpan));
- list.get().append(cssValuePool.createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
+ list.get().append(cssValuePool().createIdentifierValue(CSSValueSpan));
+ list.get().append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
} else
- list.get().append(cssValuePool.createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
+ list.get().append(cssValuePool().createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
if (!position.namedGridLine().isNull())
- list.get().append(cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
- return WTFMove(list);
+ list.get().append(cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
+ return std::move(list);
}
-#endif
-static Ref<CSSValue> createTransitionPropertyValue(const Animation& animation)
+static PassRef<CSSValue> createTransitionPropertyValue(const Animation& animation)
{
if (animation.animationMode() == Animation::AnimateNone)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
if (animation.animationMode() == Animation::AnimateAll)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAll);
- return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createIdentifierValue(CSSValueAll);
+ return cssValuePool().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
}
-static Ref<CSSValueList> getTransitionPropertyValue(const AnimationList* animList)
+static PassRef<CSSValueList> getTransitionPropertyValue(const AnimationList* animList)
{
auto list = CSSValueList::createCommaSeparated();
if (animList) {
for (size_t i = 0; i < animList->size(); ++i)
list.get().append(createTransitionPropertyValue(animList->animation(i)));
} else
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAll));
- return list;
-}
-
-#if ENABLE(CSS_SCROLL_SNAP)
-static Ref<CSSValueList> scrollSnapDestination(RenderStyle& style, const LengthSize& destination)
-{
- auto list = CSSValueList::createSpaceSeparated();
- list.get().append(zoomAdjustedPixelValueForLength(destination.width(), style));
- list.get().append(zoomAdjustedPixelValueForLength(destination.height(), style));
+ list.get().append(cssValuePool().createIdentifierValue(CSSValueAll));
return list;
}
-static Ref<CSSValue> scrollSnapPoints(RenderStyle& style, const ScrollSnapPoints* points)
-{
- if (!points)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
-
- if (points->usesElements)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueElements);
- auto list = CSSValueList::createSpaceSeparated();
- for (auto& point : points->offsets)
- list.get().append(zoomAdjustedPixelValueForLength(point, style));
- if (points->hasRepeat)
- list.get().append(CSSValuePool::singleton().createValue(LengthRepeat::create(zoomAdjustedPixelValueForLength(points->repeatOffset, style))));
- return WTFMove(list);
-}
-
-static Ref<CSSValue> scrollSnapCoordinates(RenderStyle& style, const Vector<LengthSize>& coordinates)
-{
- if (coordinates.isEmpty())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
-
- auto list = CSSValueList::createCommaSeparated();
-
- for (auto& coordinate : coordinates) {
- auto pair = CSSValueList::createSpaceSeparated();
- pair.get().append(zoomAdjustedPixelValueForLength(coordinate.width(), style));
- pair.get().append(zoomAdjustedPixelValueForLength(coordinate.height(), style));
- list.get().append(WTFMove(pair));
- }
-
- return WTFMove(list);
-}
-#endif
-
-static Ref<CSSValue> getWillChangePropertyValue(const WillChangeData* willChangeData)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- if (!willChangeData || !willChangeData->numFeatures())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
-
- auto list = CSSValueList::createCommaSeparated();
- for (size_t i = 0; i < willChangeData->numFeatures(); ++i) {
- WillChangeData::FeaturePropertyPair feature = willChangeData->featureAt(i);
- switch (feature.first) {
- case WillChangeData::ScrollPosition:
- list.get().append(cssValuePool.createIdentifierValue(CSSValueScrollPosition));
- break;
- case WillChangeData::Contents:
- list.get().append(cssValuePool.createIdentifierValue(CSSValueContents));
- break;
- case WillChangeData::Property:
- list.get().append(cssValuePool.createIdentifierValue(feature.second));
- break;
- case WillChangeData::Invalid:
- ASSERT_NOT_REACHED();
- break;
- }
- }
-
- return WTFMove(list);
-}
-
-static inline void appendLigaturesValue(CSSValueList& list, FontVariantLigatures value, CSSValueID yesValue, CSSValueID noValue)
-{
- switch (value) {
- case FontVariantLigatures::Normal:
- return;
- case FontVariantLigatures::No:
- list.append(CSSValuePool::singleton().createIdentifierValue(noValue));
- return;
- case FontVariantLigatures::Yes:
- list.append(CSSValuePool::singleton().createIdentifierValue(yesValue));
- return;
- }
- ASSERT_NOT_REACHED();
-}
-
-static Ref<CSSValue> fontVariantLigaturesPropertyValue(FontVariantLigatures common, FontVariantLigatures discretionary, FontVariantLigatures historical, FontVariantLigatures contextualAlternates)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- if (common == FontVariantLigatures::No && discretionary == FontVariantLigatures::No && historical == FontVariantLigatures::No && contextualAlternates == FontVariantLigatures::No)
- return cssValuePool.createIdentifierValue(CSSValueNone);
- if (common == FontVariantLigatures::Normal && discretionary == FontVariantLigatures::Normal && historical == FontVariantLigatures::Normal && contextualAlternates == FontVariantLigatures::Normal)
- return cssValuePool.createIdentifierValue(CSSValueNormal);
-
- auto valueList = CSSValueList::createSpaceSeparated();
- appendLigaturesValue(valueList, common, CSSValueCommonLigatures, CSSValueNoCommonLigatures);
- appendLigaturesValue(valueList, discretionary, CSSValueDiscretionaryLigatures, CSSValueNoDiscretionaryLigatures);
- appendLigaturesValue(valueList, historical, CSSValueHistoricalLigatures, CSSValueNoHistoricalLigatures);
- appendLigaturesValue(valueList, contextualAlternates, CSSValueContextual, CSSValueNoContextual);
- return WTFMove(valueList);
-}
-
-static Ref<CSSValue> fontVariantPositionPropertyValue(FontVariantPosition position)
+static PassRef<CSSValueList> getDelayValue(const AnimationList* animList)
{
- auto& cssValuePool = CSSValuePool::singleton();
- CSSValueID valueID = CSSValueNormal;
- switch (position) {
- case FontVariantPosition::Normal:
- break;
- case FontVariantPosition::Subscript:
- valueID = CSSValueSub;
- break;
- case FontVariantPosition::Superscript:
- valueID = CSSValueSuper;
- break;
- }
- return cssValuePool.createIdentifierValue(valueID);
-}
-
-static Ref<CSSValue> fontVariantCapsPropertyValue(FontVariantCaps caps)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- CSSValueID valueID = CSSValueNormal;
- switch (caps) {
- case FontVariantCaps::Normal:
- break;
- case FontVariantCaps::Small:
- valueID = CSSValueSmallCaps;
- break;
- case FontVariantCaps::AllSmall:
- valueID = CSSValueAllSmallCaps;
- break;
- case FontVariantCaps::Petite:
- valueID = CSSValuePetiteCaps;
- break;
- case FontVariantCaps::AllPetite:
- valueID = CSSValueAllPetiteCaps;
- break;
- case FontVariantCaps::Unicase:
- valueID = CSSValueUnicase;
- break;
- case FontVariantCaps::Titling:
- valueID = CSSValueTitlingCaps;
- break;
- }
- return cssValuePool.createIdentifierValue(valueID);
-}
-
-static Ref<CSSValue> fontVariantNumericPropertyValue(FontVariantNumericFigure figure, FontVariantNumericSpacing spacing, FontVariantNumericFraction fraction, FontVariantNumericOrdinal ordinal, FontVariantNumericSlashedZero slashedZero)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- if (figure == FontVariantNumericFigure::Normal && spacing == FontVariantNumericSpacing::Normal && fraction == FontVariantNumericFraction::Normal && ordinal == FontVariantNumericOrdinal::Normal && slashedZero == FontVariantNumericSlashedZero::Normal)
- return cssValuePool.createIdentifierValue(CSSValueNormal);
-
- auto valueList = CSSValueList::createSpaceSeparated();
- switch (figure) {
- case FontVariantNumericFigure::Normal:
- break;
- case FontVariantNumericFigure::LiningNumbers:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueLiningNums));
- break;
- case FontVariantNumericFigure::OldStyleNumbers:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueOldstyleNums));
- break;
- }
-
- switch (spacing) {
- case FontVariantNumericSpacing::Normal:
- break;
- case FontVariantNumericSpacing::ProportionalNumbers:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueProportionalNums));
- break;
- case FontVariantNumericSpacing::TabularNumbers:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueTabularNums));
- break;
- }
-
- switch (fraction) {
- case FontVariantNumericFraction::Normal:
- break;
- case FontVariantNumericFraction::DiagonalFractions:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueDiagonalFractions));
- break;
- case FontVariantNumericFraction::StackedFractions:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueStackedFractions));
- break;
- }
-
- if (ordinal == FontVariantNumericOrdinal::Yes)
- valueList->append(cssValuePool.createIdentifierValue(CSSValueOrdinal));
- if (slashedZero == FontVariantNumericSlashedZero::Yes)
- valueList->append(cssValuePool.createIdentifierValue(CSSValueSlashedZero));
-
- return WTFMove(valueList);
-}
-
-static Ref<CSSValue> fontVariantAlternatesPropertyValue(FontVariantAlternates alternates)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- CSSValueID valueID = CSSValueNormal;
- switch (alternates) {
- case FontVariantAlternates::Normal:
- break;
- case FontVariantAlternates::HistoricalForms:
- valueID = CSSValueHistoricalForms;
- break;
- }
- return cssValuePool.createIdentifierValue(valueID);
-}
-
-static Ref<CSSValue> fontVariantEastAsianPropertyValue(FontVariantEastAsianVariant variant, FontVariantEastAsianWidth width, FontVariantEastAsianRuby ruby)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- if (variant == FontVariantEastAsianVariant::Normal && width == FontVariantEastAsianWidth::Normal && ruby == FontVariantEastAsianRuby::Normal)
- return cssValuePool.createIdentifierValue(CSSValueNormal);
-
- auto valueList = CSSValueList::createSpaceSeparated();
- switch (variant) {
- case FontVariantEastAsianVariant::Normal:
- break;
- case FontVariantEastAsianVariant::Jis78:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueJis78));
- break;
- case FontVariantEastAsianVariant::Jis83:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueJis83));
- break;
- case FontVariantEastAsianVariant::Jis90:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueJis90));
- break;
- case FontVariantEastAsianVariant::Jis04:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueJis04));
- break;
- case FontVariantEastAsianVariant::Simplified:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueSimplified));
- break;
- case FontVariantEastAsianVariant::Traditional:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueTraditional));
- break;
- }
-
- switch (width) {
- case FontVariantEastAsianWidth::Normal:
- break;
- case FontVariantEastAsianWidth::Full:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueFullWidth));
- break;
- case FontVariantEastAsianWidth::Proportional:
- valueList->append(cssValuePool.createIdentifierValue(CSSValueProportionalWidth));
- break;
- }
-
- if (ruby == FontVariantEastAsianRuby::Yes)
- valueList->append(cssValuePool.createIdentifierValue(CSSValueRuby));
-
- return WTFMove(valueList);
-}
-
-static Ref<CSSValueList> getDelayValue(const AnimationList* animList)
-{
- auto& cssValuePool = CSSValuePool::singleton();
auto list = CSSValueList::createCommaSeparated();
if (animList) {
for (size_t i = 0; i < animList->size(); ++i)
- list.get().append(cssValuePool.createValue(animList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
+ list.get().append(cssValuePool().createValue(animList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
} else {
// Note that initialAnimationDelay() is used for both transitions and animations
- list.get().append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
+ list.get().append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
}
return list;
}
-static Ref<CSSValueList> getDurationValue(const AnimationList* animList)
+static PassRef<CSSValueList> getDurationValue(const AnimationList* animList)
{
- auto& cssValuePool = CSSValuePool::singleton();
auto list = CSSValueList::createCommaSeparated();
if (animList) {
for (size_t i = 0; i < animList->size(); ++i)
- list.get().append(cssValuePool.createValue(animList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
+ list.get().append(cssValuePool().createValue(animList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
} else {
// Note that initialAnimationDuration() is used for both transitions and animations
- list.get().append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
+ list.get().append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
}
return list;
}
-static Ref<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
+static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
{
switch (timingFunction->type()) {
case TimingFunction::CubicBezierFunction: {
@@ -1441,12 +1101,14 @@ static Ref<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunct
case CubicBezierTimingFunction::EaseOut:
valueId = CSSValueEaseOut;
break;
- default:
- ASSERT(bezierTimingFunction->timingFunctionPreset() == CubicBezierTimingFunction::EaseInOut);
+ case CubicBezierTimingFunction::EaseInOut:
valueId = CSSValueEaseInOut;
break;
+ default:
+ ASSERT_NOT_REACHED();
+ return 0;
}
- return CSSValuePool::singleton().createIdentifierValue(valueId);
+ return cssValuePool().createIdentifierValue(valueId);
}
return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunction->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFunction->y2());
}
@@ -1454,13 +1116,14 @@ static Ref<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunct
const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
}
- default:
- ASSERT(timingFunction->type() == TimingFunction::LinearFunction);
- return CSSValuePool::singleton().createIdentifierValue(CSSValueLinear);
+ case TimingFunction::LinearFunction:
+ return cssValuePool().createIdentifierValue(CSSValueLinear);
}
+ ASSERT_NOT_REACHED();
+ return 0;
}
-static Ref<CSSValueList> getTimingFunctionValue(const AnimationList* animList)
+static PassRef<CSSValueList> getTimingFunctionValue(const AnimationList* animList)
{
auto list = CSSValueList::createCommaSeparated();
if (animList) {
@@ -1468,44 +1131,14 @@ static Ref<CSSValueList> getTimingFunctionValue(const AnimationList* animList)
list.get().append(createTimingFunctionValue(animList->animation(i).timingFunction().get()));
} else
// Note that initialAnimationTimingFunction() is used for both transitions and animations
- list.get().append(createTimingFunctionValue(Animation::initialTimingFunction().get()));
- return list;
-}
-
-#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-static Ref<CSSValue> createAnimationTriggerValue(const AnimationTrigger* trigger, const RenderStyle& style)
-{
- switch (trigger->type()) {
- case AnimationTrigger::AnimationTriggerType::ScrollAnimationTriggerType: {
- auto& scrollAnimationTrigger = downcast<ScrollAnimationTrigger>(*trigger);
- if (scrollAnimationTrigger.endValue().isAuto())
- return CSSAnimationTriggerScrollValue::create(zoomAdjustedPixelValueForLength(scrollAnimationTrigger.startValue(), style));
- return CSSAnimationTriggerScrollValue::create(zoomAdjustedPixelValueForLength(scrollAnimationTrigger.startValue(), style),
- zoomAdjustedPixelValueForLength(scrollAnimationTrigger.endValue(), style));
- }
- default:
- ASSERT(trigger->type() == AnimationTrigger::AnimationTriggerType::AutoAnimationTriggerType);
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
- }
-}
-
-static Ref<CSSValueList> getAnimationTriggerValue(const AnimationList* animList, const RenderStyle& style)
-{
- auto list = CSSValueList::createCommaSeparated();
- if (animList) {
- for (size_t i = 0; i < animList->size(); ++i)
- list.get().append(createAnimationTriggerValue(animList->animation(i).trigger().get(), style));
- } else
- list.get().append(createAnimationTriggerValue(Animation::initialTrigger().get(), style));
-
+ list.get().append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
return list;
}
-#endif
-static Ref<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
+static PassRef<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
{
if (!lineBoxContain)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSLineBoxContainValue::create(lineBoxContain);
}
@@ -1523,8 +1156,8 @@ CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, boo
, m_refCount(1)
{
unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
- m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoElementType(
- (pseudoElementName.substringSharingImpl(nameWithoutColonsStart))));
+ m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
+ AtomicString(pseudoElementName.substring(nameWithoutColonsStart))));
}
CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
@@ -1551,7 +1184,7 @@ String CSSComputedStyleDeclaration::cssText() const
if (i)
result.append(' ');
result.append(getPropertyName(computedProperties[i]));
- result.appendLiteral(": ");
+ result.append(": ", 2);
result.append(getPropertyValue(computedProperties[i]));
result.append(';');
}
@@ -1564,21 +1197,28 @@ void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
ec = NO_MODIFICATION_ALLOWED_ERR;
}
-RefPtr<CSSPrimitiveValue> ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword() const
+static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
+{
+ ASSERT_ARG(keywordSize, keywordSize);
+ ASSERT_ARG(keywordSize, keywordSize <= 8);
+ return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
+}
+
+PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword() const
{
if (!m_node)
- return nullptr;
+ return 0;
m_node->document().updateLayoutIgnorePendingStylesheets();
RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
if (!style)
- return nullptr;
+ return 0;
- if (CSSValueID sizeIdentifier = style->fontDescription().keywordSizeAsIdentifier())
- return CSSValuePool::singleton().createIdentifierValue(sizeIdentifier);
+ if (int keywordSize = style->fontDescription().keywordSize())
+ return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
- return zoomAdjustedPixelValue(style->fontDescription().computedSize(), *style);
+ return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
}
bool ComputedStyleExtractor::useFixedFontDefaultSize() const
@@ -1611,143 +1251,121 @@ static CSSValueID identifierForFamily(const AtomicString& family)
return CSSValueInvalid;
}
-static Ref<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
+static PassRef<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
{
if (CSSValueID familyIdentifier = identifierForFamily(family))
- return CSSValuePool::singleton().createIdentifierValue(familyIdentifier);
- return CSSValuePool::singleton().createFontFamilyValue(family);
+ return cssValuePool().createIdentifierValue(familyIdentifier);
+ return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
}
-static Ref<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
+static PassRef<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
{
- auto& cssValuePool = CSSValuePool::singleton();
// Blink value is ignored.
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (textDecoration & TextDecorationUnderline)
- list->append(cssValuePool.createIdentifierValue(CSSValueUnderline));
+ list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
if (textDecoration & TextDecorationOverline)
- list->append(cssValuePool.createIdentifierValue(CSSValueOverline));
+ list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
if (textDecoration & TextDecorationLineThrough)
- list->append(cssValuePool.createIdentifierValue(CSSValueLineThrough));
+ list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
#if ENABLE(LETTERPRESS)
if (textDecoration & TextDecorationLetterpress)
- list->append(cssValuePool.createIdentifierValue(CSSValueWebkitLetterpress));
+ list->append(cssValuePool().createIdentifierValue(CSSValueWebkitLetterpress));
#endif
if (!list->length())
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
return list.releaseNonNull();
}
-static Ref<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
+static PassRef<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
{
switch (textDecorationStyle) {
case TextDecorationStyleSolid:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueSolid);
+ return cssValuePool().createIdentifierValue(CSSValueSolid);
case TextDecorationStyleDouble:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueDouble);
+ return cssValuePool().createIdentifierValue(CSSValueDouble);
case TextDecorationStyleDotted:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueDotted);
+ return cssValuePool().createIdentifierValue(CSSValueDotted);
case TextDecorationStyleDashed:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueDashed);
+ return cssValuePool().createIdentifierValue(CSSValueDashed);
case TextDecorationStyleWavy:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueWavy);
+ return cssValuePool().createIdentifierValue(CSSValueWavy);
}
ASSERT_NOT_REACHED();
- return CSSValuePool::singleton().createExplicitInitialValue();
+ return cssValuePool().createExplicitInitialValue();
}
-static Ref<CSSValue> renderTextDecorationSkipFlagsToCSSValue(TextDecorationSkip textDecorationSkip)
+static PassRef<CSSValue> renderTextDecorationSkipFlagsToCSSValue(TextDecorationSkip textDecorationSkip)
{
switch (textDecorationSkip) {
- case TextDecorationSkipAuto:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
case TextDecorationSkipNone:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createExplicitInitialValue();
case TextDecorationSkipInk:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueInk);
- case TextDecorationSkipObjects:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueObjects);
+ return cssValuePool().createIdentifierValue(CSSValueInk);
}
ASSERT_NOT_REACHED();
- return CSSValuePool::singleton().createExplicitInitialValue();
+ return cssValuePool().createExplicitInitialValue();
}
-static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition textEmphasisPosition)
+static PassRef<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition textEmphasisPosition)
{
ASSERT(!((textEmphasisPosition & TextEmphasisPositionOver) && (textEmphasisPosition & TextEmphasisPositionUnder)));
ASSERT(!((textEmphasisPosition & TextEmphasisPositionLeft) && (textEmphasisPosition & TextEmphasisPositionRight)));
- auto& cssValuePool = CSSValuePool::singleton();
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (textEmphasisPosition & TextEmphasisPositionOver)
- list->append(cssValuePool.createIdentifierValue(CSSValueOver));
+ list->append(cssValuePool().createIdentifierValue(CSSValueOver));
if (textEmphasisPosition & TextEmphasisPositionUnder)
- list->append(cssValuePool.createIdentifierValue(CSSValueUnder));
+ list->append(cssValuePool().createIdentifierValue(CSSValueUnder));
if (textEmphasisPosition & TextEmphasisPositionLeft)
- list->append(cssValuePool.createIdentifierValue(CSSValueLeft));
+ list->append(cssValuePool().createIdentifierValue(CSSValueLeft));
if (textEmphasisPosition & TextEmphasisPositionRight)
- list->append(cssValuePool.createIdentifierValue(CSSValueRight));
+ list->append(cssValuePool().createIdentifierValue(CSSValueRight));
if (!list->length())
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
return list.releaseNonNull();
}
-static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (hangingPunctuation & FirstHangingPunctuation)
- list->append(cssValuePool.createIdentifierValue(CSSValueFirst));
- if (hangingPunctuation & AllowEndHangingPunctuation)
- list->append(cssValuePool.createIdentifierValue(CSSValueAllowEnd));
- if (hangingPunctuation & ForceEndHangingPunctuation)
- list->append(cssValuePool.createIdentifierValue(CSSValueForceEnd));
- if (hangingPunctuation & LastHangingPunctuation)
- list->append(cssValuePool.createIdentifierValue(CSSValueLast));
- if (!list->length())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return list.releaseNonNull();
-}
-
-static Ref<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
+static PassRef<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
{
// For backwards compatibility, if both values are equal, just return one of them. And
// if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
- auto& cssValuePool = CSSValuePool::singleton();
if (xRepeat == yRepeat)
- return cssValuePool.createValue(xRepeat);
+ return cssValuePool().createValue(xRepeat);
if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
- return cssValuePool.createIdentifierValue(CSSValueRepeatX);
+ return cssValuePool().createIdentifierValue(CSSValueRepeatX);
if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
- return cssValuePool.createIdentifierValue(CSSValueRepeatY);
+ return cssValuePool().createIdentifierValue(CSSValueRepeatY);
auto list = CSSValueList::createSpaceSeparated();
- list.get().append(cssValuePool.createValue(xRepeat));
- list.get().append(cssValuePool.createValue(yRepeat));
- return WTFMove(list);
+ list.get().append(cssValuePool().createValue(xRepeat));
+ list.get().append(cssValuePool().createValue(yRepeat));
+ return std::move(list);
}
-static Ref<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
+static PassRefPtr<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
{
switch (type) {
case MaskAlpha:
- return CSSValuePool::singleton().createValue(CSSValueAlpha);
- default:
- ASSERT(type == MaskLuminance);
- return CSSValuePool::singleton().createValue(CSSValueLuminance);
+ return cssValuePool().createValue(CSSValueAlpha);
+ case MaskLuminance:
+ return cssValuePool().createValue(CSSValueLuminance);
}
-}
-static Ref<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle& style)
+ ASSERT_NOT_REACHED();
+
+ return 0;
+}
+static PassRef<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle* style)
{
if (fillSize.type == Contain)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueContain);
+ return cssValuePool().createIdentifierValue(CSSValueContain);
if (fillSize.type == Cover)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueCover);
+ return cssValuePool().createIdentifierValue(CSSValueCover);
if (fillSize.size.height().isAuto())
return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
@@ -1755,327 +1373,135 @@ static Ref<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderSt
auto list = CSSValueList::createSpaceSeparated();
list.get().append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
list.get().append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style));
- return WTFMove(list);
+ return std::move(list);
}
-static Ref<CSSValue> altTextToCSSValue(const RenderStyle* style)
+static PassRef<CSSValue> altTextToCSSValue(const RenderStyle* style)
{
- return CSSValuePool::singleton().createValue(style->contentAltText(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createValue(style->contentAltText(), CSSPrimitiveValue::CSS_STRING);
}
-static Ref<CSSValueList> contentToCSSValue(const RenderStyle* style)
+static PassRef<CSSValueList> contentToCSSValue(const RenderStyle* style)
{
- auto& cssValuePool = CSSValuePool::singleton();
auto list = CSSValueList::createSpaceSeparated();
for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
- if (is<CounterContentData>(*contentData))
- list.get().append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
- else if (is<ImageContentData>(*contentData))
- list.get().append(*downcast<ImageContentData>(*contentData).image().cssValue());
- else if (is<TextContentData>(*contentData))
- list.get().append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSPrimitiveValue::CSS_STRING));
+ if (contentData->isCounter()) {
+ const CounterContent* counter = static_cast<const CounterContentData*>(contentData)->counter();
+ ASSERT(counter);
+ list.get().append(cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
+ } else if (contentData->isImage()) {
+ const StyleImage* image = static_cast<const ImageContentData*>(contentData)->image();
+ ASSERT(image);
+ list.get().append(image->cssValue());
+ } else if (contentData->isText())
+ list.get().append(cssValuePool().createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
}
if (style->hasFlowFrom())
- list.get().append(cssValuePool.createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
+ list.get().append(cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
return list;
}
-static RefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPropertyID propertyID)
+static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPropertyID propertyID)
{
const CounterDirectiveMap* map = style->counterDirectives();
if (!map)
- return nullptr;
+ return 0;
- auto& cssValuePool = CSSValuePool::singleton();
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
- list->append(cssValuePool.createValue(it->key, CSSPrimitiveValue::CSS_STRING));
+ list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
short number = propertyID == CSSPropertyCounterIncrement ? it->value.incrementValue() : it->value.resetValue();
- list->append(cssValuePool.createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
+ list->append(cssValuePool().createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
}
return list.release();
}
static void logUnimplementedPropertyID(CSSPropertyID propertyID)
{
- static NeverDestroyed<HashSet<CSSPropertyID>> propertyIDSet;
- if (!propertyIDSet.get().add(propertyID).isNewEntry)
+ DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
+ if (!propertyIDSet.add(propertyID).isNewEntry)
return;
LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
}
-static Ref<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
+static PassRef<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
{
auto list = CSSValueList::createCommaSeparated();
- for (unsigned i = 0; i < style->fontCascade().familyCount(); ++i)
- list.get().append(valueForFamily(style->fontCascade().familyAt(i)));
+ for (unsigned i = 0; i < style->font().familyCount(); ++i)
+ list.get().append(valueForFamily(style->font().familyAt(i)));
return list;
}
-static Ref<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle& style)
+static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
{
- Length length = style.lineHeight();
- if (length.isNegative()) // If true, line-height not set; use the font's line spacing.
- return zoomAdjustedPixelValue(style.fontMetrics().floatLineSpacing(), style);
- if (length.isPercent()) {
+ Length length = style->lineHeight();
+ if (length.isNegative())
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
+ if (length.isPercent())
// This is imperfect, because it doesn't include the zoom factor and the real computation
// for how high to be in pixels does include things like minimum font size and the zoom factor.
// On the other hand, since font-size doesn't include the zoom factor, we really can't do
// that here either.
- return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style.fontDescription().specifiedSize()) / 100, style);
- }
- return zoomAdjustedPixelValue(floatValueForLength(length, 0), style);
+ return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
+ return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
}
-static Ref<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle& style)
+static PassRef<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
{
- return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
+ return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style);
}
-static Ref<CSSPrimitiveValue> fontStyleFromStyle(RenderStyle* style)
+static PassRef<CSSPrimitiveValue> fontStyleFromStyle(RenderStyle* style)
{
if (style->fontDescription().italic())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueItalic);
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createIdentifierValue(CSSValueItalic);
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
}
-static Ref<CSSValue> fontVariantFromStyle(RenderStyle* style)
+static PassRef<CSSPrimitiveValue> fontVariantFromStyle(RenderStyle* style)
{
- if (style->fontDescription().variantSettings().isAllNormal())
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-
- auto list = CSSValueList::createSpaceSeparated();
-
- switch (style->fontDescription().variantCommonLigatures()) {
- case FontVariantLigatures::Normal:
- break;
- case FontVariantLigatures::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueCommonLigatures));
- break;
- case FontVariantLigatures::No:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoCommonLigatures));
- break;
- }
-
- switch (style->fontDescription().variantDiscretionaryLigatures()) {
- case FontVariantLigatures::Normal:
- break;
- case FontVariantLigatures::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiscretionaryLigatures));
- break;
- case FontVariantLigatures::No:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoDiscretionaryLigatures));
- break;
- }
-
- switch (style->fontDescription().variantHistoricalLigatures()) {
- case FontVariantLigatures::Normal:
- break;
- case FontVariantLigatures::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalLigatures));
- break;
- case FontVariantLigatures::No:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoHistoricalLigatures));
- break;
- }
-
- switch (style->fontDescription().variantContextualAlternates()) {
- case FontVariantLigatures::Normal:
- break;
- case FontVariantLigatures::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueContextual));
- break;
- case FontVariantLigatures::No:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoContextual));
- break;
- }
-
- switch (style->fontDescription().variantPosition()) {
- case FontVariantPosition::Normal:
- break;
- case FontVariantPosition::Subscript:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSub));
- break;
- case FontVariantPosition::Superscript:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSuper));
- break;
- }
-
- switch (style->fontDescription().variantCaps()) {
- case FontVariantCaps::Normal:
- break;
- case FontVariantCaps::Small:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
- break;
- case FontVariantCaps::AllSmall:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllSmallCaps));
- break;
- case FontVariantCaps::Petite:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValuePetiteCaps));
- break;
- case FontVariantCaps::AllPetite:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllPetiteCaps));
- break;
- case FontVariantCaps::Unicase:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueUnicase));
- break;
- case FontVariantCaps::Titling:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTitlingCaps));
- break;
- }
-
- switch (style->fontDescription().variantNumericFigure()) {
- case FontVariantNumericFigure::Normal:
- break;
- case FontVariantNumericFigure::LiningNumbers:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueLiningNums));
- break;
- case FontVariantNumericFigure::OldStyleNumbers:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueOldstyleNums));
- break;
- }
-
- switch (style->fontDescription().variantNumericSpacing()) {
- case FontVariantNumericSpacing::Normal:
- break;
- case FontVariantNumericSpacing::ProportionalNumbers:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalNums));
- break;
- case FontVariantNumericSpacing::TabularNumbers:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTabularNums));
- break;
- }
-
- switch (style->fontDescription().variantNumericFraction()) {
- case FontVariantNumericFraction::Normal:
- break;
- case FontVariantNumericFraction::DiagonalFractions:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiagonalFractions));
- break;
- case FontVariantNumericFraction::StackedFractions:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueStackedFractions));
- break;
- }
-
- switch (style->fontDescription().variantNumericOrdinal()) {
- case FontVariantNumericOrdinal::Normal:
- break;
- case FontVariantNumericOrdinal::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueOrdinal));
- break;
- }
-
- switch (style->fontDescription().variantNumericSlashedZero()) {
- case FontVariantNumericSlashedZero::Normal:
- break;
- case FontVariantNumericSlashedZero::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSlashedZero));
- break;
- }
-
- switch (style->fontDescription().variantAlternates()) {
- case FontVariantAlternates::Normal:
- break;
- case FontVariantAlternates::HistoricalForms:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalForms));
- break;
- }
-
- switch (style->fontDescription().variantEastAsianVariant()) {
- case FontVariantEastAsianVariant::Normal:
- break;
- case FontVariantEastAsianVariant::Jis78:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis78));
- break;
- case FontVariantEastAsianVariant::Jis83:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis83));
- break;
- case FontVariantEastAsianVariant::Jis90:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis90));
- break;
- case FontVariantEastAsianVariant::Jis04:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis04));
- break;
- case FontVariantEastAsianVariant::Simplified:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSimplified));
- break;
- case FontVariantEastAsianVariant::Traditional:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTraditional));
- break;
- }
-
- switch (style->fontDescription().variantEastAsianWidth()) {
- case FontVariantEastAsianWidth::Normal:
- break;
- case FontVariantEastAsianWidth::Full:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueFullWidth));
- break;
- case FontVariantEastAsianWidth::Proportional:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth));
- break;
- }
-
- switch (style->fontDescription().variantEastAsianRuby()) {
- case FontVariantEastAsianRuby::Normal:
- break;
- case FontVariantEastAsianRuby::Yes:
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueRuby));
- break;
- }
-
- return WTFMove(list);
+ if (style->fontDescription().smallCaps())
+ return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
}
-static Ref<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style)
+static PassRef<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style)
{
switch (style->fontDescription().weight()) {
case FontWeight100:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue100);
+ return cssValuePool().createIdentifierValue(CSSValue100);
case FontWeight200:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue200);
+ return cssValuePool().createIdentifierValue(CSSValue200);
case FontWeight300:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue300);
+ return cssValuePool().createIdentifierValue(CSSValue300);
case FontWeightNormal:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
case FontWeight500:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue500);
+ return cssValuePool().createIdentifierValue(CSSValue500);
case FontWeight600:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue600);
+ return cssValuePool().createIdentifierValue(CSSValue600);
case FontWeightBold:
- return CSSValuePool::singleton().createIdentifierValue(CSSValueBold);
+ return cssValuePool().createIdentifierValue(CSSValueBold);
case FontWeight800:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue800);
+ return cssValuePool().createIdentifierValue(CSSValue800);
case FontWeight900:
- return CSSValuePool::singleton().createIdentifierValue(CSSValue900);
+ return cssValuePool().createIdentifierValue(CSSValue900);
}
ASSERT_NOT_REACHED();
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-}
-
-static Ref<CSSValue> fontSynthesisFromStyle(RenderStyle& style)
-{
- if (style.fontDescription().fontSynthesis() == FontSynthesisNone)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
-
- auto list = CSSValueList::createSpaceSeparated();
- if (style.fontDescription().fontSynthesis() & FontSynthesisStyle)
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueStyle));
- if (style.fontDescription().fontSynthesis() & FontSynthesisWeight)
- list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueWeight));
- return Ref<CSSValue>(list.get());
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
}
typedef const Length& (RenderStyle::*RenderStyleLengthGetter)() const;
typedef LayoutUnit (RenderBoxModelObject::*RenderBoxComputedCSSValueGetter)() const;
template<RenderStyleLengthGetter lengthGetter, RenderBoxComputedCSSValueGetter computedCSSValueGetter>
-inline RefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(RenderStyle& style, RenderObject* renderer)
+inline PassRefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(RenderStyle* style, RenderObject* renderer)
{
- Length unzoomzedLength = (style.*lengthGetter)();
- if (!is<RenderBox>(renderer) || unzoomzedLength.isFixed())
+ Length unzoomzedLength = (style->*lengthGetter)();
+ if (!renderer || !renderer->isBox() || unzoomzedLength.isFixed())
return zoomAdjustedPixelValueForLength(unzoomzedLength, style);
- return zoomAdjustedPixelValue((downcast<RenderBox>(*renderer).*computedCSSValueGetter)(), style);
+ return zoomAdjustedPixelValue((toRenderBox(renderer)->*computedCSSValueGetter)(), style);
}
template<RenderStyleLengthGetter lengthGetter>
@@ -2086,68 +1512,16 @@ inline bool paddingOrMarginIsRendererDependent(RenderStyle* style, RenderObject*
return !(style && (style->*lengthGetter)().isFixed());
}
-static CSSValueID convertToPageBreak(BreakBetween value)
-{
- if (value == PageBreakBetween || value == LeftPageBreakBetween || value == RightPageBreakBetween
- || value == RectoPageBreakBetween || value == VersoPageBreakBetween)
- return CSSValueAlways; // CSS 2.1 allows us to map these to always.
- if (value == AvoidBreakBetween || value == AvoidPageBreakBetween)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-
-static CSSValueID convertToColumnBreak(BreakBetween value)
-{
- if (value == ColumnBreakBetween)
- return CSSValueAlways;
- if (value == AvoidBreakBetween || value == AvoidColumnBreakBetween)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-
-static CSSValueID convertToPageBreak(BreakInside value)
-{
- if (value == AvoidBreakInside || value == AvoidPageBreakInside)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-
-static CSSValueID convertToColumnBreak(BreakInside value)
-{
- if (value == AvoidBreakInside || value == AvoidColumnBreakInside)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-
-#if ENABLE(CSS_REGIONS)
-static CSSValueID convertToRegionBreak(BreakBetween value)
-{
- if (value == RegionBreakBetween)
- return CSSValueAlways;
- if (value == AvoidBreakBetween || value == AvoidRegionBreakBetween)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-
-static CSSValueID convertToRegionBreak(BreakInside value)
-{
- if (value == AvoidBreakInside || value == AvoidRegionBreakInside)
- return CSSValueAvoid;
- return CSSValueAuto;
-}
-#endif
-
static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, RenderObject* renderer)
{
switch (propertyID) {
case CSSPropertyWidth:
case CSSPropertyHeight:
- case CSSPropertyPerspectiveOrigin:
- case CSSPropertyTransformOrigin:
- case CSSPropertyTransform:
- case CSSPropertyFilter:
-#if ENABLE(FILTERS_LEVEL_2)
- case CSSPropertyWebkitBackdropFilter:
+ case CSSPropertyWebkitPerspectiveOrigin:
+ case CSSPropertyWebkitTransformOrigin:
+ case CSSPropertyWebkitTransform:
+#if ENABLE(CSS_FILTERS)
+ case CSSPropertyWebkitFilter:
#endif
return true;
case CSSPropertyMargin: {
@@ -2178,13 +1552,6 @@ static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, Rend
return paddingOrMarginIsRendererDependent<&RenderStyle::paddingBottom>(style, renderer);
case CSSPropertyPaddingLeft:
return paddingOrMarginIsRendererDependent<&RenderStyle::paddingLeft>(style, renderer);
-#if ENABLE(CSS_GRID_LAYOUT)
- case CSSPropertyWebkitGridTemplateColumns:
- case CSSPropertyWebkitGridTemplateRows:
- case CSSPropertyWebkitGridTemplate:
- case CSSPropertyWebkitGrid:
- return renderer && renderer->isRenderGrid();
-#endif
default:
return false;
}
@@ -2193,202 +1560,95 @@ static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, Rend
Node* ComputedStyleExtractor::styledNode() const
{
if (!m_node)
- return nullptr;
- if (!is<Element>(*m_node))
+ return 0;
+ if (!m_node->isElementNode())
return m_node.get();
- Element& element = downcast<Element>(*m_node);
+ Element* element = toElement(m_node.get());
PseudoElement* pseudoElement;
- if (m_pseudoElementSpecifier == BEFORE && (pseudoElement = element.beforePseudoElement()))
+ if (m_pseudoElementSpecifier == BEFORE && (pseudoElement = element->beforePseudoElement()))
return pseudoElement;
- if (m_pseudoElementSpecifier == AFTER && (pseudoElement = element.afterPseudoElement()))
+ if (m_pseudoElementSpecifier == AFTER && (pseudoElement = element->afterPseudoElement()))
return pseudoElement;
- return &element;
+ return element;
}
-static ItemPosition resolveContainerAlignmentAuto(ItemPosition position, RenderObject* element)
-{
- if (position != ItemPositionAuto || !element)
- return position;
-
- return element->style().isDisplayFlexibleOrGridBox() ? ItemPositionStretch : ItemPositionStart;
-}
-
-static ItemPosition resolveSelfAlignmentAuto(ItemPosition position, OverflowAlignment& overflow, RenderObject* element)
-{
- if (position != ItemPositionAuto || !element || element->isOutOfFlowPositioned())
- return position;
-
- RenderBlock* parent = element->containingBlock();
- if (!parent)
- return ItemPositionStart;
-
- overflow = parent->style().alignItemsOverflowAlignment();
- return resolveContainerAlignmentAuto(parent->style().alignItemsPosition(), parent);
-}
-
-static void resolveContentAlignmentAuto(ContentPosition& position, ContentDistributionType& distribution, RenderObject* element)
-{
- if (position != ContentPositionAuto || distribution != ContentDistributionDefault || !element)
- return;
-
- // Even that both align-content and justify-content 'auto' values are resolved to 'stretch'
- // in case of flexbox containers, 'stretch' value in justify-content will behave like 'flex-start'.
- if (element->style().isDisplayFlexibleBox())
- distribution = ContentDistributionStretch;
- else
- position = ContentPositionStart;
-}
-
-RefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
{
return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).propertyValue(propertyID, updateLayout);
}
-Ref<MutableStyleProperties> CSSComputedStyleDeclaration::copyProperties() const
+PassRef<MutableStyleProperties> CSSComputedStyleDeclaration::copyProperties() const
{
return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).copyProperties();
}
-static inline bool nodeOrItsAncestorNeedsStyleRecalc(const Node& node)
+static inline bool nodeOrItsAncestorNeedsStyleRecalc(Node* styledNode)
{
- if (node.needsStyleRecalc())
+ if (styledNode->document().hasPendingForcedStyleRecalc())
return true;
-
- const Node* currentNode = &node;
- const Element* ancestor = currentNode->parentOrShadowHostElement();
- while (ancestor) {
- if (ancestor->needsStyleRecalc())
- return true;
-
- if (ancestor->directChildNeedsStyleRecalc() && currentNode->styleIsAffectedByPreviousSibling())
+ for (Node* n = styledNode; n; n = n->parentNode()) {// FIXME: Call parentOrShadowHostNode() instead
+ if (n->needsStyleRecalc())
return true;
-
- currentNode = ancestor;
- ancestor = currentNode->parentOrShadowHostElement();
}
return false;
}
-static inline bool updateStyleIfNeededForNode(const Node& node)
-{
- Document& document = node.document();
- if (!document.hasPendingForcedStyleRecalc() && !(document.childNeedsStyleRecalc() && nodeOrItsAncestorNeedsStyleRecalc(node)))
- return false;
- document.updateStyleIfNeeded();
- return true;
-}
-
-static inline RefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
+static inline PassRefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
{
RenderObject* renderer = styledNode->renderer();
if (renderer && renderer->isComposited() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
- RefPtr<RenderStyle> style = renderer->animation().getAnimatedStyleForRenderer(downcast<RenderElement>(*renderer));
+ AnimationUpdateBlock animationUpdateBlock(&renderer->animation());
+ RefPtr<RenderStyle> style = renderer->animation().getAnimatedStyleForRenderer(toRenderElement(renderer));
if (pseudoElementSpecifier && !styledNode->isPseudoElement()) {
// FIXME: This cached pseudo style will only exist if the animation has been run at least once.
return style->getCachedPseudoStyle(pseudoElementSpecifier);
}
- return style;
+ return style.release();
}
return styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : pseudoElementSpecifier);
}
#if ENABLE(CSS_SHAPES)
-static Ref<CSSValue> shapePropertyValue(const RenderStyle& style, const ShapeValue* shapeValue)
+static PassRefPtr<CSSValue> shapePropertyValue(const RenderStyle* style, const ShapeValue* shapeValue)
{
if (!shapeValue)
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
- if (shapeValue->type() == ShapeValue::Type::Box)
- return CSSValuePool::singleton().createValue(shapeValue->cssBox());
+ if (shapeValue->type() == ShapeValue::Outside)
+ return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
- if (shapeValue->type() == ShapeValue::Type::Image) {
- if (shapeValue->image())
- return *shapeValue->image()->cssValue();
- return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
- }
+ if (shapeValue->type() == ShapeValue::Box)
+ return cssValuePool().createValue(shapeValue->layoutBox());
+
+ if (shapeValue->type() == ShapeValue::Image)
+ return shapeValue->image() ? shapeValue->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone);
- ASSERT(shapeValue->type() == ShapeValue::Type::Shape);
+ ASSERT(shapeValue->type() == ShapeValue::Shape);
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(valueForBasicShape(style, *shapeValue->shape()));
- if (shapeValue->cssBox() != BoxMissing)
- list->append(CSSValuePool::singleton().createValue(shapeValue->cssBox()));
- return list.releaseNonNull();
+ list->append(valueForBasicShape(style, shapeValue->shape()));
+ if (shapeValue->layoutBox() != BoxMissing)
+ list->append(cssValuePool().createValue(shapeValue->layoutBox()));
+ return list.release();
}
#endif
-static RefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
-{
- auto& cssValuePool = CSSValuePool::singleton();
- RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
- if (positionType == LegacyPosition)
- result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
- result->append(cssValuePool.createValue(itemPosition));
- if (overflowAlignment != OverflowAlignmentDefault)
- result->append(cssValuePool.createValue(overflowAlignment));
- ASSERT(result->length() <= 2);
- return result;
-}
-
-static RefPtr<CSSValueList> valueForContentPositionAndDistributionWithOverflowAlignment(ContentPosition position, ContentDistributionType distribution, OverflowAlignment overflowAlignment)
-{
- RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
- if (distribution != ContentDistributionDefault)
- result->append(CSSPrimitiveValue::create(distribution));
- if (distribution == ContentDistributionDefault || position != ContentPositionAuto)
- result->append(CSSPrimitiveValue::create(position));
- if ((position >= ContentPositionCenter || distribution != ContentDistributionDefault) && overflowAlignment != OverflowAlignmentDefault)
- result->append(CSSPrimitiveValue::create(overflowAlignment));
- ASSERT(result->length() > 0);
- ASSERT(result->length() <= 3);
- return result;
-}
-
-inline static bool isFlexOrGrid(ContainerNode* element)
-{
- return element && element->computedStyle() && element->computedStyle()->isDisplayFlexibleOrGridBox();
-}
-
-RefPtr<CSSValue> ComputedStyleExtractor::customPropertyValue(const String& propertyName) const
-{
- Node* styledNode = this->styledNode();
- if (!styledNode)
- return nullptr;
-
- if (updateStyleIfNeededForNode(*styledNode)) {
- // The style recalc could have caused the styled node to be discarded or replaced
- // if it was a PseudoElement so we need to update it.
- styledNode = this->styledNode();
- }
-
- RefPtr<RenderStyle> style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, CSSPropertyCustom);
- if (!style || !style->hasCustomProperty(propertyName))
- return nullptr;
-
- return style->getCustomPropertyValue(propertyName);
-}
-
-String ComputedStyleExtractor::customPropertyText(const String& propertyName) const
-{
- RefPtr<CSSValue> propertyValue = this->customPropertyValue(propertyName);
- return propertyValue ? propertyValue->cssText() : emptyString();
-}
-
-RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
+PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
{
Node* styledNode = this->styledNode();
if (!styledNode)
- return nullptr;
+ return 0;
RefPtr<RenderStyle> style;
- RenderObject* renderer = nullptr;
+ RenderObject* renderer = 0;
bool forceFullLayout = false;
if (updateLayout) {
Document& document = styledNode->document();
- if (updateStyleIfNeededForNode(*styledNode)) {
+ if (nodeOrItsAncestorNeedsStyleRecalc(styledNode)) {
+ document.updateStyleIfNeeded();
// The style recalc could have caused the styled node to be discarded or replaced
// if it was a PseudoElement so we need to update it.
styledNode = this->styledNode();
@@ -2396,15 +1656,17 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
renderer = styledNode->renderer();
- if (propertyID == CSSPropertyDisplay && !renderer && is<SVGElement>(*styledNode) && !downcast<SVGElement>(*styledNode).isValid())
+#if ENABLE(SVG)
+ if (propertyID == CSSPropertyDisplay && !renderer && isSVGElement(*styledNode) && !toSVGElement(*styledNode).isValid())
return nullptr;
-
+#endif
style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, propertyID);
// FIXME: Some of these cases could be narrowed down or optimized better.
forceFullLayout = isLayoutDependent(propertyID, style.get(), renderer)
|| styledNode->isInShadowTree()
- || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement());
+ || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement())
+ || document.seamlessParentIFrame();
if (forceFullLayout) {
document.updateLayoutIgnorePendingStylesheets();
@@ -2418,9 +1680,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
}
if (!style)
- return nullptr;
+ return 0;
- auto& cssValuePool = CSSValuePool::singleton();
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
switch (propertyID) {
@@ -2428,41 +1689,41 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
break;
case CSSPropertyBackgroundColor:
- return cssValuePool.createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
+ return cssValuePool().createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
case CSSPropertyBackgroundImage:
case CSSPropertyWebkitMaskImage: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
if (!layers)
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
if (!layers->next()) {
if (layers->image())
return layers->image()->cssValue();
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
}
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
if (currLayer->image())
- list->append(*currLayer->image()->cssValue());
+ list->append(currLayer->image()->cssValue());
else
- list->append(cssValuePool.createIdentifierValue(CSSValueNone));
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
}
- return list;
+ return list.release();
}
case CSSPropertyBackgroundSize:
case CSSPropertyWebkitBackgroundSize:
case CSSPropertyWebkitMaskSize: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
if (!layers->next())
- return fillSizeToCSSValue(layers->size(), *style);
+ return fillSizeToCSSValue(layers->size(), style.get());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(fillSizeToCSSValue(currLayer->size(), *style));
+ list->append(fillSizeToCSSValue(currLayer->size(), style.get()));
- return list;
+ return list.release();
}
case CSSPropertyBackgroundRepeat:
case CSSPropertyWebkitMaskRepeat: {
@@ -2474,13 +1735,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY()));
- return list;
+ return list.release();
}
case CSSPropertyWebkitMaskSourceType: {
const FillLayer* layers = style->maskLayers();
if (!layers)
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
if (!layers->next())
return fillSourceTypeToCSSValue(layers->maskSourceType());
@@ -2489,30 +1750,30 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
list->append(fillSourceTypeToCSSValue(currLayer->maskSourceType()));
- return list;
+ return list.release();
}
case CSSPropertyWebkitBackgroundComposite:
case CSSPropertyWebkitMaskComposite: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
if (!layers->next())
- return cssValuePool.createValue(layers->composite());
+ return cssValuePool().createValue(layers->composite());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(cssValuePool.createValue(currLayer->composite()));
+ list->append(cssValuePool().createValue(currLayer->composite()));
- return list;
+ return list.release();
}
case CSSPropertyBackgroundAttachment: {
const FillLayer* layers = style->backgroundLayers();
if (!layers->next())
- return cssValuePool.createValue(layers->attachment());
+ return cssValuePool().createValue(layers->attachment());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(cssValuePool.createValue(currLayer->attachment()));
+ list->append(cssValuePool().createValue(currLayer->attachment()));
- return list;
+ return list.release();
}
case CSSPropertyBackgroundClip:
case CSSPropertyBackgroundOrigin:
@@ -2524,172 +1785,172 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
if (!layers->next()) {
EFillBox box = isClip ? layers->clip() : layers->origin();
- return cssValuePool.createValue(box);
+ return cssValuePool().createValue(box);
}
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
- list->append(cssValuePool.createValue(box));
+ list->append(cssValuePool().createValue(box));
}
- return list;
+ return list.release();
}
case CSSPropertyBackgroundPosition:
case CSSPropertyWebkitMaskPosition: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
if (!layers->next())
- return createPositionListForLayer(propertyID, layers, *style);
+ return createPositionListForLayer(propertyID, layers, style.get());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(createPositionListForLayer(propertyID, currLayer, *style));
- return list;
+ list->append(createPositionListForLayer(propertyID, currLayer, style.get()));
+ return list.release();
}
case CSSPropertyBackgroundPositionX:
case CSSPropertyWebkitMaskPositionX: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
if (!layers->next())
- return cssValuePool.createValue(layers->xPosition());
+ return cssValuePool().createValue(layers->xPosition());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(cssValuePool.createValue(currLayer->xPosition()));
+ list->append(cssValuePool().createValue(currLayer->xPosition()));
- return list;
+ return list.release();
}
case CSSPropertyBackgroundPositionY:
case CSSPropertyWebkitMaskPositionY: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
if (!layers->next())
- return cssValuePool.createValue(layers->yPosition());
+ return cssValuePool().createValue(layers->yPosition());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(cssValuePool.createValue(currLayer->yPosition()));
+ list->append(cssValuePool().createValue(currLayer->yPosition()));
- return list;
+ return list.release();
}
case CSSPropertyBorderCollapse:
if (style->borderCollapse())
- return cssValuePool.createIdentifierValue(CSSValueCollapse);
- return cssValuePool.createIdentifierValue(CSSValueSeparate);
+ return cssValuePool().createIdentifierValue(CSSValueCollapse);
+ return cssValuePool().createIdentifierValue(CSSValueSeparate);
case CSSPropertyBorderSpacing: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style));
- list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style));
- return list;
+ list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
+ list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
+ return list.release();
}
case CSSPropertyWebkitBorderHorizontalSpacing:
- return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style);
+ return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
case CSSPropertyWebkitBorderVerticalSpacing:
- return zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style);
+ return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
case CSSPropertyBorderImageSource:
if (style->borderImageSource())
return style->borderImageSource()->cssValue();
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
case CSSPropertyBorderTopColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
case CSSPropertyBorderRightColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
case CSSPropertyBorderBottomColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
case CSSPropertyBorderLeftColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
case CSSPropertyBorderTopStyle:
- return cssValuePool.createValue(style->borderTopStyle());
+ return cssValuePool().createValue(style->borderTopStyle());
case CSSPropertyBorderRightStyle:
- return cssValuePool.createValue(style->borderRightStyle());
+ return cssValuePool().createValue(style->borderRightStyle());
case CSSPropertyBorderBottomStyle:
- return cssValuePool.createValue(style->borderBottomStyle());
+ return cssValuePool().createValue(style->borderBottomStyle());
case CSSPropertyBorderLeftStyle:
- return cssValuePool.createValue(style->borderLeftStyle());
+ return cssValuePool().createValue(style->borderLeftStyle());
case CSSPropertyBorderTopWidth:
- return zoomAdjustedPixelValue(style->borderTopWidth(), *style);
+ return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
case CSSPropertyBorderRightWidth:
- return zoomAdjustedPixelValue(style->borderRightWidth(), *style);
+ return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
case CSSPropertyBorderBottomWidth:
- return zoomAdjustedPixelValue(style->borderBottomWidth(), *style);
+ return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
case CSSPropertyBorderLeftWidth:
- return zoomAdjustedPixelValue(style->borderLeftWidth(), *style);
+ return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
case CSSPropertyBottom:
- return positionOffsetValue(*style, CSSPropertyBottom);
+ return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document().renderView());
case CSSPropertyWebkitBoxAlign:
- return cssValuePool.createValue(style->boxAlign());
+ return cssValuePool().createValue(style->boxAlign());
#if ENABLE(CSS_BOX_DECORATION_BREAK)
case CSSPropertyWebkitBoxDecorationBreak:
if (style->boxDecorationBreak() == DSLICE)
- return cssValuePool.createIdentifierValue(CSSValueSlice);
- return cssValuePool.createIdentifierValue(CSSValueClone);
+ return cssValuePool().createIdentifierValue(CSSValueSlice);
+ return cssValuePool().createIdentifierValue(CSSValueClone);
#endif
case CSSPropertyWebkitBoxDirection:
- return cssValuePool.createValue(style->boxDirection());
+ return cssValuePool().createValue(style->boxDirection());
case CSSPropertyWebkitBoxFlex:
- return cssValuePool.createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitBoxFlexGroup:
- return cssValuePool.createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitBoxLines:
- return cssValuePool.createValue(style->boxLines());
+ return cssValuePool().createValue(style->boxLines());
case CSSPropertyWebkitBoxOrdinalGroup:
- return cssValuePool.createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitBoxOrient:
- return cssValuePool.createValue(style->boxOrient());
+ return cssValuePool().createValue(style->boxOrient());
case CSSPropertyWebkitBoxPack:
- return cssValuePool.createValue(style->boxPack());
+ return cssValuePool().createValue(style->boxPack());
case CSSPropertyWebkitBoxReflect:
- return valueForReflection(style->boxReflect(), *style);
+ return valueForReflection(style->boxReflect(), style.get());
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
- return valueForShadow(style->boxShadow(), propertyID, *style);
+ return valueForShadow(style->boxShadow(), propertyID, style.get());
case CSSPropertyCaptionSide:
- return cssValuePool.createValue(style->captionSide());
+ return cssValuePool().createValue(style->captionSide());
case CSSPropertyClear:
- return cssValuePool.createValue(style->clear());
+ return cssValuePool().createValue(style->clear());
case CSSPropertyColor:
- return cssValuePool.createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
+ return cssValuePool().createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
case CSSPropertyWebkitPrintColorAdjust:
- return cssValuePool.createValue(style->printColorAdjust());
+ return cssValuePool().createValue(style->printColorAdjust());
case CSSPropertyWebkitColumnAxis:
- return cssValuePool.createValue(style->columnAxis());
- case CSSPropertyColumnCount:
+ return cssValuePool().createValue(style->columnAxis());
+ case CSSPropertyWebkitColumnCount:
if (style->hasAutoColumnCount())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
- case CSSPropertyColumnFill:
- return cssValuePool.createValue(style->columnFill());
- case CSSPropertyColumnGap:
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
+ case CSSPropertyWebkitColumnFill:
+ return cssValuePool().createValue(style->columnFill());
+ case CSSPropertyWebkitColumnGap:
if (style->hasNormalColumnGap())
- return cssValuePool.createIdentifierValue(CSSValueNormal);
- return zoomAdjustedPixelValue(style->columnGap(), *style);
- case CSSPropertyColumnProgression:
- return cssValuePool.createValue(style->columnProgression());
- case CSSPropertyColumnRuleColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
- case CSSPropertyColumnRuleStyle:
- return cssValuePool.createValue(style->columnRuleStyle());
- case CSSPropertyColumnRuleWidth:
- return zoomAdjustedPixelValue(style->columnRuleWidth(), *style);
- case CSSPropertyColumnSpan:
- return cssValuePool.createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return zoomAdjustedPixelValue(style->columnGap(), style.get());
+ case CSSPropertyWebkitColumnProgression:
+ return cssValuePool().createValue(style->columnProgression());
+ case CSSPropertyWebkitColumnRuleColor:
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
+ case CSSPropertyWebkitColumnRuleStyle:
+ return cssValuePool().createValue(style->columnRuleStyle());
+ case CSSPropertyWebkitColumnRuleWidth:
+ return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
+ case CSSPropertyWebkitColumnSpan:
+ return cssValuePool().createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
case CSSPropertyWebkitColumnBreakAfter:
- return cssValuePool.createValue(convertToColumnBreak(style->breakAfter()));
+ return cssValuePool().createValue(style->columnBreakAfter());
case CSSPropertyWebkitColumnBreakBefore:
- return cssValuePool.createValue(convertToColumnBreak(style->breakBefore()));
+ return cssValuePool().createValue(style->columnBreakBefore());
case CSSPropertyWebkitColumnBreakInside:
- return cssValuePool.createValue(convertToColumnBreak(style->breakInside()));
- case CSSPropertyColumnWidth:
+ return cssValuePool().createValue(style->columnBreakInside());
+ case CSSPropertyWebkitColumnWidth:
if (style->hasAutoColumnWidth())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(style->columnWidth(), *style);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return zoomAdjustedPixelValue(style->columnWidth(), style.get());
case CSSPropertyTabSize:
- return cssValuePool.createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
#if ENABLE(CSS_REGIONS)
case CSSPropertyWebkitRegionBreakAfter:
- return cssValuePool.createValue(convertToRegionBreak(style->breakAfter()));
+ return cssValuePool().createValue(style->regionBreakAfter());
case CSSPropertyWebkitRegionBreakBefore:
- return cssValuePool.createValue(convertToRegionBreak(style->breakBefore()));
+ return cssValuePool().createValue(style->regionBreakBefore());
case CSSPropertyWebkitRegionBreakInside:
- return cssValuePool.createValue(convertToRegionBreak(style->breakInside()));
+ return cssValuePool().createValue(style->regionBreakInside());
#endif
case CSSPropertyCursor: {
RefPtr<CSSValueList> list;
@@ -2698,83 +1959,68 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
list = CSSValueList::createCommaSeparated();
for (unsigned i = 0; i < cursors->size(); ++i)
if (StyleImage* image = cursors->at(i).image())
- list->append(*image->cssValue());
+ list->append(image->cssValue());
}
- auto value = cssValuePool.createValue(style->cursor());
+ RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
if (list) {
- list->append(WTFMove(value));
- return list;
+ list->append(value.release());
+ return list.release();
}
- return WTFMove(value);
+ return value.release();
}
#if ENABLE(CURSOR_VISIBILITY)
case CSSPropertyWebkitCursorVisibility:
- return cssValuePool.createValue(style->cursorVisibility());
+ return cssValuePool().createValue(style->cursorVisibility());
#endif
case CSSPropertyDirection:
- return cssValuePool.createValue(style->direction());
+ return cssValuePool().createValue(style->direction());
case CSSPropertyDisplay:
- return cssValuePool.createValue(style->display());
+ return cssValuePool().createValue(style->display());
case CSSPropertyEmptyCells:
- return cssValuePool.createValue(style->emptyCells());
- case CSSPropertyAlignContent: {
- ContentPosition position = style->alignContentPosition();
- ContentDistributionType distribution = style->alignContentDistribution();
- resolveContentAlignmentAuto(position, distribution, renderer);
- return valueForContentPositionAndDistributionWithOverflowAlignment(position, distribution, style->alignContentOverflowAlignment());
- }
- case CSSPropertyAlignItems:
- return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->alignItemsPosition(), renderer), style->alignItemsOverflowAlignment(), NonLegacyPosition);
- case CSSPropertyAlignSelf: {
- OverflowAlignment overflow = style->alignSelfOverflowAlignment();
- ItemPosition alignSelf = resolveSelfAlignmentAuto(style->alignSelfPosition(), overflow, renderer);
- return valueForItemPositionWithOverflowAlignment(alignSelf, overflow, NonLegacyPosition);
- }
- case CSSPropertyFlex:
- return getCSSPropertyValuesForShorthandProperties(flexShorthand());
- case CSSPropertyFlexBasis:
- return cssValuePool.createValue(style->flexBasis());
- case CSSPropertyFlexDirection:
- return cssValuePool.createValue(style->flexDirection());
- case CSSPropertyFlexFlow:
- return getCSSPropertyValuesForShorthandProperties(flexFlowShorthand());
- case CSSPropertyFlexGrow:
- return cssValuePool.createValue(style->flexGrow());
- case CSSPropertyFlexShrink:
- return cssValuePool.createValue(style->flexShrink());
- case CSSPropertyFlexWrap:
- return cssValuePool.createValue(style->flexWrap());
- case CSSPropertyJustifyContent: {
- ContentPosition position = style->justifyContentPosition();
- ContentDistributionType distribution = style->justifyContentDistribution();
- resolveContentAlignmentAuto(position, distribution, renderer);
- return valueForContentPositionAndDistributionWithOverflowAlignment(position, distribution, style->justifyContentOverflowAlignment());
- }
- case CSSPropertyJustifyItems:
- return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->justifyItemsPosition(), renderer), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
- case CSSPropertyJustifySelf: {
- OverflowAlignment overflow = style->justifySelfOverflowAlignment();
- ItemPosition justifySelf = resolveSelfAlignmentAuto(style->justifySelfPosition(), overflow, renderer);
- return valueForItemPositionWithOverflowAlignment(justifySelf, overflow, NonLegacyPosition);
- }
- case CSSPropertyOrder:
- return cssValuePool.createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->emptyCells());
+ case CSSPropertyWebkitAlignContent:
+ return cssValuePool().createValue(style->alignContent());
+ case CSSPropertyWebkitAlignItems:
+ return cssValuePool().createValue(style->alignItems());
+ case CSSPropertyWebkitAlignSelf:
+ if (style->alignSelf() == AlignAuto) {
+ Node* parent = styledNode->parentNode();
+ if (parent && parent->computedStyle())
+ return cssValuePool().createValue(parent->computedStyle()->alignItems());
+ return cssValuePool().createValue(AlignStretch);
+ }
+ return cssValuePool().createValue(style->alignSelf());
+ case CSSPropertyWebkitFlex:
+ return getCSSPropertyValuesForShorthandProperties(webkitFlexShorthand());
+ case CSSPropertyWebkitFlexBasis:
+ return cssValuePool().createValue(style->flexBasis());
+ case CSSPropertyWebkitFlexDirection:
+ return cssValuePool().createValue(style->flexDirection());
+ case CSSPropertyWebkitFlexFlow:
+ return getCSSPropertyValuesForShorthandProperties(webkitFlexFlowShorthand());
+ case CSSPropertyWebkitFlexGrow:
+ return cssValuePool().createValue(style->flexGrow());
+ case CSSPropertyWebkitFlexShrink:
+ return cssValuePool().createValue(style->flexShrink());
+ case CSSPropertyWebkitFlexWrap:
+ return cssValuePool().createValue(style->flexWrap());
+ case CSSPropertyWebkitJustifyContent:
+ return cssValuePool().createValue(style->justifyContent());
+ case CSSPropertyWebkitOrder:
+ return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyFloat:
if (style->display() != NONE && style->hasOutOfFlowPosition())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return cssValuePool.createValue(style->floating());
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->floating());
case CSSPropertyFont: {
RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
computedFont->style = fontStyleFromStyle(style.get());
- if (style->fontDescription().variantCaps() == FontVariantCaps::Small)
- computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps);
- else
- computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
+ computedFont->variant = fontVariantFromStyle(style.get());
computedFont->weight = fontWeightFromStyle(style.get());
- computedFont->size = fontSizeFromStyle(*style);
- computedFont->lineHeight = lineHeightFromStyle(*style);
+ computedFont->size = fontSizeFromStyle(style.get());
+ computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document().renderView());
computedFont->family = fontFamilyFromStyle(style.get());
- return computedFont;
+ return computedFont.release();
}
case CSSPropertyFontFamily: {
RefPtr<CSSValueList> fontFamilyList = fontFamilyFromStyle(style.get());
@@ -2782,56 +2028,37 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
// NOTE: Gecko always returns this as a comma-separated CSSPrimitiveValue string.
if (fontFamilyList->length() == 1)
return fontFamilyList->item(0);
- return fontFamilyList;
+ return fontFamilyList.release();
}
case CSSPropertyFontSize:
- return fontSizeFromStyle(*style);
+ return fontSizeFromStyle(style.get());
case CSSPropertyFontStyle:
return fontStyleFromStyle(style.get());
case CSSPropertyFontVariant:
return fontVariantFromStyle(style.get());
case CSSPropertyFontWeight:
return fontWeightFromStyle(style.get());
- case CSSPropertyFontSynthesis:
- return fontSynthesisFromStyle(*style);
- case CSSPropertyFontFeatureSettings: {
- const FontFeatureSettings& featureSettings = style->fontDescription().featureSettings();
- if (!featureSettings.size())
- return cssValuePool.createIdentifierValue(CSSValueNormal);
+ case CSSPropertyWebkitFontFeatureSettings: {
+ const FontFeatureSettings* featureSettings = style->fontDescription().featureSettings();
+ if (!featureSettings || !featureSettings->size())
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (auto& feature : featureSettings)
- list->append(CSSFontFeatureValue::create(FontFeatureTag(feature.tag()), feature.value()));
- return list;
- }
-#if ENABLE(CSS_GRID_LAYOUT)
- case CSSPropertyWebkitGridAutoFlow: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- ASSERT(style->isGridAutoFlowDirectionRow() || style->isGridAutoFlowDirectionColumn());
- if (style->isGridAutoFlowDirectionRow())
- list->append(cssValuePool.createIdentifierValue(CSSValueRow));
- else
- list->append(cssValuePool.createIdentifierValue(CSSValueColumn));
-
- if (style->isGridAutoFlowAlgorithmDense())
- list->append(cssValuePool.createIdentifierValue(CSSValueDense));
-
- return list;
+ for (unsigned i = 0; i < featureSettings->size(); ++i) {
+ const FontFeature& feature = featureSettings->at(i);
+ list->append(CSSFontFeatureValue::create(feature.tag(), feature.value()));
+ }
+ return list.release();
}
-
- // Specs mention that getComputedStyle() should return the used value of the property instead of the computed
- // one for grid-definition-{rows|columns} but not for the grid-auto-{rows|columns} as things like
- // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as the '2fr' means very different things
- // depending on the size of the explicit grid or the number of implicit tracks added to the grid. See
- // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html
case CSSPropertyWebkitGridAutoColumns:
- return specifiedValueForGridTrackSize(style->gridAutoColumns(), *style);
+ return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
+ case CSSPropertyWebkitGridAutoFlow:
+ return cssValuePool().createValue(style->gridAutoFlow());
case CSSPropertyWebkitGridAutoRows:
- return specifiedValueForGridTrackSize(style->gridAutoRows(), *style);
-
- case CSSPropertyWebkitGridTemplateColumns:
- return valueForGridTrackList(ForColumns, renderer, *style);
- case CSSPropertyWebkitGridTemplateRows:
- return valueForGridTrackList(ForRows, renderer, *style);
+ return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
+ case CSSPropertyWebkitGridDefinitionColumns:
+ return valueForGridTrackList(style->gridColumns(), style->namedGridColumnLines(), style.get(), m_node->document().renderView());
+ case CSSPropertyWebkitGridDefinitionRows:
+ return valueForGridTrackList(style->gridRows(), style->namedGridRowLines(), style.get(), m_node->document().renderView());
case CSSPropertyWebkitGridColumnStart:
return valueForGridPosition(style->gridItemColumnStart());
@@ -2843,44 +2070,38 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
return valueForGridPosition(style->gridItemRowEnd());
case CSSPropertyWebkitGridArea:
return getCSSPropertyValuesForGridShorthand(webkitGridAreaShorthand());
- case CSSPropertyWebkitGridTemplate:
- return getCSSPropertyValuesForGridShorthand(webkitGridTemplateShorthand());
- case CSSPropertyWebkitGrid:
- return getCSSPropertyValuesForGridShorthand(webkitGridShorthand());
case CSSPropertyWebkitGridColumn:
return getCSSPropertyValuesForGridShorthand(webkitGridColumnShorthand());
case CSSPropertyWebkitGridRow:
return getCSSPropertyValuesForGridShorthand(webkitGridRowShorthand());
- case CSSPropertyWebkitGridTemplateAreas:
+ case CSSPropertyWebkitGridTemplate:
if (!style->namedGridAreaRowCount()) {
ASSERT(!style->namedGridAreaColumnCount());
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
}
- return CSSGridTemplateAreasValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
- case CSSPropertyWebkitGridColumnGap:
- return zoomAdjustedPixelValueForLength(style->gridColumnGap(), *style);
- case CSSPropertyWebkitGridRowGap:
- return zoomAdjustedPixelValueForLength(style->gridRowGap(), *style);
- case CSSPropertyWebkitGridGap:
- return getCSSPropertyValuesForGridShorthand(webkitGridGapShorthand());
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
+ return CSSGridTemplateValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
+
case CSSPropertyHeight:
- if (renderer && !renderer->isRenderSVGModelObject()) {
+ if (renderer) {
// According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
// the "height" property does not apply for non-replaced inline elements.
if (!renderer->isReplaced() && renderer->isInline())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(sizingBox(*renderer).height(), *style);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get());
}
- return zoomAdjustedPixelValueForLength(style->height(), *style);
+ return zoomAdjustedPixelValueForLength(style->height(), style.get());
+ case CSSPropertyWebkitHighlight:
+ if (style->highlight() == nullAtom)
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->highlight(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitHyphens:
- return cssValuePool.createValue(style->hyphens());
+ return cssValuePool().createValue(style->hyphens());
case CSSPropertyWebkitHyphenateCharacter:
if (style->hyphenationString().isNull())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitHyphenateLimitAfter:
if (style->hyphenationLimitAfter() < 0)
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
@@ -2895,165 +2116,158 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
return CSSPrimitiveValue::create(style->hyphenationLimitLines(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitBorderFit:
if (style->borderFit() == BorderFitBorder)
- return cssValuePool.createIdentifierValue(CSSValueBorder);
- return cssValuePool.createIdentifierValue(CSSValueLines);
+ return cssValuePool().createIdentifierValue(CSSValueBorder);
+ return cssValuePool().createIdentifierValue(CSSValueLines);
#if ENABLE(CSS_IMAGE_ORIENTATION)
case CSSPropertyImageOrientation:
- return cssValuePool.createValue(style->imageOrientation());
+ return cssValuePool().createValue(style->imageOrientation());
#endif
case CSSPropertyImageRendering:
return CSSPrimitiveValue::create(style->imageRendering());
#if ENABLE(CSS_IMAGE_RESOLUTION)
case CSSPropertyImageResolution:
- return cssValuePool.createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
+ return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
#endif
case CSSPropertyLeft:
- return positionOffsetValue(*style, CSSPropertyLeft);
+ return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document().renderView());
case CSSPropertyLetterSpacing:
if (!style->letterSpacing())
- return cssValuePool.createIdentifierValue(CSSValueNormal);
- return zoomAdjustedPixelValue(style->letterSpacing(), *style);
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
case CSSPropertyWebkitLineClamp:
if (style->lineClamp().isNone())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return cssValuePool.createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyLineHeight:
- return lineHeightFromStyle(*style);
+ return lineHeightFromStyle(style.get(), m_node->document().renderView());
case CSSPropertyListStyleImage:
if (style->listStyleImage())
return style->listStyleImage()->cssValue();
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
case CSSPropertyListStylePosition:
- return cssValuePool.createValue(style->listStylePosition());
+ return cssValuePool().createValue(style->listStylePosition());
case CSSPropertyListStyleType:
- return cssValuePool.createValue(style->listStyleType());
+ return cssValuePool().createValue(style->listStyleType());
case CSSPropertyWebkitLocale:
if (style->locale().isNull())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->locale(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->locale(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyMarginTop:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginTop, &RenderBoxModelObject::marginTop>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginTop, &RenderBoxModelObject::marginTop>(style.get(), renderer);
case CSSPropertyMarginRight: {
Length marginRight = style->marginRight();
- if (marginRight.isFixed() || !is<RenderBox>(renderer))
- return zoomAdjustedPixelValueForLength(marginRight, *style);
+ if (marginRight.isFixed() || !renderer || !renderer->isBox())
+ return zoomAdjustedPixelValueForLength(marginRight, style.get());
float value;
- if (marginRight.isPercentOrCalculated()) {
+ if (marginRight.isPercent() || marginRight.isViewportPercentage())
// RenderBox gives a marginRight() that is the distance between the right-edge of the child box
// and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
// value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
- value = minimumValueForLength(marginRight, downcast<RenderBox>(*renderer).containingBlockLogicalWidthForContent());
- } else
- value = downcast<RenderBox>(*renderer).marginRight();
- return zoomAdjustedPixelValue(value, *style);
+ value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
+ else
+ value = toRenderBox(renderer)->marginRight();
+ return zoomAdjustedPixelValue(value, style.get());
}
case CSSPropertyMarginBottom:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginBottom, &RenderBoxModelObject::marginBottom>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginBottom, &RenderBoxModelObject::marginBottom>(style.get(), renderer);
case CSSPropertyMarginLeft:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginLeft, &RenderBoxModelObject::marginLeft>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginLeft, &RenderBoxModelObject::marginLeft>(style.get(), renderer);
case CSSPropertyWebkitMarqueeDirection:
- return cssValuePool.createValue(style->marqueeDirection());
+ return cssValuePool().createValue(style->marqueeDirection());
case CSSPropertyWebkitMarqueeIncrement:
- return cssValuePool.createValue(style->marqueeIncrement());
+ return cssValuePool().createValue(style->marqueeIncrement());
case CSSPropertyWebkitMarqueeRepetition:
if (style->marqueeLoopCount() < 0)
- return cssValuePool.createIdentifierValue(CSSValueInfinite);
- return cssValuePool.createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createIdentifierValue(CSSValueInfinite);
+ return cssValuePool().createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitMarqueeStyle:
- return cssValuePool.createValue(style->marqueeBehavior());
+ return cssValuePool().createValue(style->marqueeBehavior());
case CSSPropertyWebkitUserModify:
- return cssValuePool.createValue(style->userModify());
+ return cssValuePool().createValue(style->userModify());
case CSSPropertyMaxHeight: {
const Length& maxHeight = style->maxHeight();
if (maxHeight.isUndefined())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValueForLength(maxHeight, *style);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return zoomAdjustedPixelValueForLength(maxHeight, style.get());
}
case CSSPropertyMaxWidth: {
const Length& maxWidth = style->maxWidth();
if (maxWidth.isUndefined())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValueForLength(maxWidth, *style);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return zoomAdjustedPixelValueForLength(maxWidth, style.get());
}
case CSSPropertyMinHeight:
- if (style->minHeight().isAuto()) {
- if (isFlexOrGrid(styledNode->parentNode()))
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(0, *style);
- }
- return zoomAdjustedPixelValueForLength(style->minHeight(), *style);
+ // FIXME: For flex-items, min-height:auto should compute to min-content.
+ if (style->minHeight().isAuto())
+ return zoomAdjustedPixelValue(0, style.get());
+ return zoomAdjustedPixelValueForLength(style->minHeight(), style.get());
case CSSPropertyMinWidth:
- if (style->minWidth().isAuto()) {
- if (isFlexOrGrid(styledNode->parentNode()))
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(0, *style);
- }
- return zoomAdjustedPixelValueForLength(style->minWidth(), *style);
+ // FIXME: For flex-items, min-width:auto should compute to min-content.
+ if (style->minWidth().isAuto())
+ return zoomAdjustedPixelValue(0, style.get());
+ return zoomAdjustedPixelValueForLength(style->minWidth(), style.get());
case CSSPropertyObjectFit:
- return cssValuePool.createValue(style->objectFit());
+ return cssValuePool().createValue(style->objectFit());
case CSSPropertyOpacity:
- return cssValuePool.createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyOrphans:
if (style->hasAutoOrphans())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyOutlineColor:
- return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
case CSSPropertyOutlineOffset:
- return zoomAdjustedPixelValue(style->outlineOffset(), *style);
+ return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
case CSSPropertyOutlineStyle:
if (style->outlineStyleIsAuto())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->outlineStyle());
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->outlineStyle());
case CSSPropertyOutlineWidth:
- return zoomAdjustedPixelValue(style->outlineWidth(), *style);
+ return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
case CSSPropertyOverflow:
- return cssValuePool.createValue(std::max(style->overflowX(), style->overflowY()));
+ return cssValuePool().createValue(std::max(style->overflowX(), style->overflowY()));
case CSSPropertyOverflowWrap:
- return cssValuePool.createValue(style->overflowWrap());
+ return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyOverflowX:
- return cssValuePool.createValue(style->overflowX());
+ return cssValuePool().createValue(style->overflowX());
case CSSPropertyOverflowY:
- return cssValuePool.createValue(style->overflowY());
+ return cssValuePool().createValue(style->overflowY());
case CSSPropertyPaddingTop:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingTop, &RenderBoxModelObject::computedCSSPaddingTop>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingTop, &RenderBoxModelObject::computedCSSPaddingTop>(style.get(), renderer);
case CSSPropertyPaddingRight:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingRight, &RenderBoxModelObject::computedCSSPaddingRight>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingRight, &RenderBoxModelObject::computedCSSPaddingRight>(style.get(), renderer);
case CSSPropertyPaddingBottom:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingBottom, &RenderBoxModelObject::computedCSSPaddingBottom>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingBottom, &RenderBoxModelObject::computedCSSPaddingBottom>(style.get(), renderer);
case CSSPropertyPaddingLeft:
- return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingLeft, &RenderBoxModelObject::computedCSSPaddingLeft>(*style, renderer);
+ return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingLeft, &RenderBoxModelObject::computedCSSPaddingLeft>(style.get(), renderer);
case CSSPropertyPageBreakAfter:
- return cssValuePool.createValue(convertToPageBreak(style->breakAfter()));
+ return cssValuePool().createValue(style->pageBreakAfter());
case CSSPropertyPageBreakBefore:
- return cssValuePool.createValue(convertToPageBreak(style->breakBefore()));
- case CSSPropertyPageBreakInside:
- return cssValuePool.createValue(convertToPageBreak(style->breakInside()));
- case CSSPropertyBreakAfter:
- return cssValuePool.createValue(style->breakAfter());
- case CSSPropertyBreakBefore:
- return cssValuePool.createValue(style->breakBefore());
- case CSSPropertyBreakInside:
- return cssValuePool.createValue(style->breakInside());
- case CSSPropertyHangingPunctuation:
- return hangingPunctuationToCSSValue(style->hangingPunctuation());
+ return cssValuePool().createValue(style->pageBreakBefore());
+ case CSSPropertyPageBreakInside: {
+ EPageBreak pageBreak = style->pageBreakInside();
+ ASSERT(pageBreak != PBALWAYS);
+ if (pageBreak == PBALWAYS)
+ return 0;
+ return cssValuePool().createValue(style->pageBreakInside());
+ }
case CSSPropertyPosition:
- return cssValuePool.createValue(style->position());
+ return cssValuePool().createValue(style->position());
case CSSPropertyRight:
- return positionOffsetValue(*style, CSSPropertyRight);
+ return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document().renderView());
case CSSPropertyWebkitRubyPosition:
- return cssValuePool.createValue(style->rubyPosition());
+ return cssValuePool().createValue(style->rubyPosition());
case CSSPropertyTableLayout:
- return cssValuePool.createValue(style->tableLayout());
+ return cssValuePool().createValue(style->tableLayout());
case CSSPropertyTextAlign:
- return cssValuePool.createValue(style->textAlign());
+ return cssValuePool().createValue(style->textAlign());
case CSSPropertyTextDecoration:
return renderTextDecorationFlagsToCSSValue(style->textDecoration());
#if ENABLE(CSS3_TEXT)
case CSSPropertyWebkitTextAlignLast:
- return cssValuePool.createValue(style->textAlignLast());
+ return cssValuePool().createValue(style->textAlignLast());
case CSSPropertyWebkitTextJustify:
- return cssValuePool.createValue(style->textJustify());
+ return cssValuePool().createValue(style->textJustify());
#endif // CSS3_TEXT
case CSSPropertyWebkitTextDecoration:
return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand());
@@ -3066,7 +2280,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWebkitTextDecorationSkip:
return renderTextDecorationSkipFlagsToCSSValue(style->textDecorationSkip());
case CSSPropertyWebkitTextUnderlinePosition:
- return cssValuePool.createValue(style->textUnderlinePosition());
+ return cssValuePool().createValue(style->textUnderlinePosition());
case CSSPropertyWebkitTextDecorationsInEffect:
return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
case CSSPropertyWebkitTextFillColor:
@@ -3078,9 +2292,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWebkitTextEmphasisStyle:
switch (style->textEmphasisMark()) {
case TextEmphasisMarkNone:
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
case TextEmphasisMarkCustom:
- return cssValuePool.createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
case TextEmphasisMarkAuto:
ASSERT_NOT_REACHED();
#if ASSERT_DISABLED
@@ -3092,205 +2306,193 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case TextEmphasisMarkTriangle:
case TextEmphasisMarkSesame: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(cssValuePool.createValue(style->textEmphasisFill()));
- list->append(cssValuePool.createValue(style->textEmphasisMark()));
- return list;
+ list->append(cssValuePool().createValue(style->textEmphasisFill()));
+ list->append(cssValuePool().createValue(style->textEmphasisMark()));
+ return list.release();
}
}
case CSSPropertyTextIndent: {
// If CSS3_TEXT is disabled or text-indent has only one value(<length> | <percentage>),
// getPropertyCSSValue() returns CSSValue.
- RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), *style);
+ RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), style.get());
#if ENABLE(CSS3_TEXT)
// If CSS3_TEXT is enabled and text-indent has -webkit-each-line or -webkit-hanging,
// getPropertyCSSValue() returns CSSValueList.
if (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging) {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(textIndent.releaseNonNull());
+ list->append(textIndent.release());
if (style->textIndentLine() == TextIndentEachLine)
- list->append(cssValuePool.createIdentifierValue(CSSValueWebkitEachLine));
+ list->append(cssValuePool().createIdentifierValue(CSSValueWebkitEachLine));
if (style->textIndentType() == TextIndentHanging)
- list->append(cssValuePool.createIdentifierValue(CSSValueWebkitHanging));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueWebkitHanging));
+ return list.release();
}
#endif
- return textIndent;
+ return textIndent.release();
}
case CSSPropertyTextShadow:
- return valueForShadow(style->textShadow(), propertyID, *style);
+ return valueForShadow(style->textShadow(), propertyID, style.get());
case CSSPropertyTextRendering:
- return cssValuePool.createValue(style->fontDescription().textRenderingMode());
+ return cssValuePool().createValue(style->fontDescription().textRenderingMode());
case CSSPropertyTextOverflow:
if (style->textOverflow())
- return cssValuePool.createIdentifierValue(CSSValueEllipsis);
- return cssValuePool.createIdentifierValue(CSSValueClip);
+ return cssValuePool().createIdentifierValue(CSSValueEllipsis);
+ return cssValuePool().createIdentifierValue(CSSValueClip);
case CSSPropertyWebkitTextSecurity:
- return cssValuePool.createValue(style->textSecurity());
+ return cssValuePool().createValue(style->textSecurity());
#if ENABLE(IOS_TEXT_AUTOSIZING)
case CSSPropertyWebkitTextSizeAdjust:
if (style->textSizeAdjust().isAuto())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
if (style->textSizeAdjust().isNone())
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSPrimitiveValue::create(style->textSizeAdjust().percentage(), CSSPrimitiveValue::CSS_PERCENTAGE);
#endif
case CSSPropertyWebkitTextStrokeColor:
return currentColorOrValidColor(style.get(), style->textStrokeColor());
case CSSPropertyWebkitTextStrokeWidth:
- return zoomAdjustedPixelValue(style->textStrokeWidth(), *style);
+ return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
case CSSPropertyTextTransform:
- return cssValuePool.createValue(style->textTransform());
+ return cssValuePool().createValue(style->textTransform());
case CSSPropertyTop:
- return positionOffsetValue(*style, CSSPropertyTop);
+ return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document().renderView());
case CSSPropertyUnicodeBidi:
- return cssValuePool.createValue(style->unicodeBidi());
+ return cssValuePool().createValue(style->unicodeBidi());
case CSSPropertyVerticalAlign:
switch (style->verticalAlign()) {
case BASELINE:
- return cssValuePool.createIdentifierValue(CSSValueBaseline);
+ return cssValuePool().createIdentifierValue(CSSValueBaseline);
case MIDDLE:
- return cssValuePool.createIdentifierValue(CSSValueMiddle);
+ return cssValuePool().createIdentifierValue(CSSValueMiddle);
case SUB:
- return cssValuePool.createIdentifierValue(CSSValueSub);
+ return cssValuePool().createIdentifierValue(CSSValueSub);
case SUPER:
- return cssValuePool.createIdentifierValue(CSSValueSuper);
+ return cssValuePool().createIdentifierValue(CSSValueSuper);
case TEXT_TOP:
- return cssValuePool.createIdentifierValue(CSSValueTextTop);
+ return cssValuePool().createIdentifierValue(CSSValueTextTop);
case TEXT_BOTTOM:
- return cssValuePool.createIdentifierValue(CSSValueTextBottom);
+ return cssValuePool().createIdentifierValue(CSSValueTextBottom);
case TOP:
- return cssValuePool.createIdentifierValue(CSSValueTop);
+ return cssValuePool().createIdentifierValue(CSSValueTop);
case BOTTOM:
- return cssValuePool.createIdentifierValue(CSSValueBottom);
+ return cssValuePool().createIdentifierValue(CSSValueBottom);
case BASELINE_MIDDLE:
- return cssValuePool.createIdentifierValue(CSSValueWebkitBaselineMiddle);
+ return cssValuePool().createIdentifierValue(CSSValueWebkitBaselineMiddle);
case LENGTH:
- return cssValuePool.createValue(style->verticalAlignLength());
+ return cssValuePool().createValue(style->verticalAlignLength());
}
ASSERT_NOT_REACHED();
- return nullptr;
+ return 0;
case CSSPropertyVisibility:
- return cssValuePool.createValue(style->visibility());
+ return cssValuePool().createValue(style->visibility());
case CSSPropertyWhiteSpace:
- return cssValuePool.createValue(style->whiteSpace());
+ return cssValuePool().createValue(style->whiteSpace());
case CSSPropertyWidows:
if (style->hasAutoWidows())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWidth:
- if (renderer && !renderer->isRenderSVGModelObject()) {
+ if (renderer) {
// According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
// the "width" property does not apply for non-replaced inline elements.
if (!renderer->isReplaced() && renderer->isInline())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(sizingBox(*renderer).width(), *style);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get());
}
- return zoomAdjustedPixelValueForLength(style->width(), *style);
- case CSSPropertyWillChange:
- return getWillChangePropertyValue(style->willChange());
- break;
+ return zoomAdjustedPixelValueForLength(style->width(), style.get());
case CSSPropertyWordBreak:
- return cssValuePool.createValue(style->wordBreak());
+ return cssValuePool().createValue(style->wordBreak());
case CSSPropertyWordSpacing:
- return zoomAdjustedPixelValue(style->fontCascade().wordSpacing(), *style);
+ return zoomAdjustedPixelValue(style->font().wordSpacing(), style.get());
case CSSPropertyWordWrap:
- return cssValuePool.createValue(style->overflowWrap());
+ return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyWebkitLineBreak:
- return cssValuePool.createValue(style->lineBreak());
+ return cssValuePool().createValue(style->lineBreak());
case CSSPropertyWebkitNbspMode:
- return cssValuePool.createValue(style->nbspMode());
+ return cssValuePool().createValue(style->nbspMode());
case CSSPropertyResize:
- return cssValuePool.createValue(style->resize());
+ return cssValuePool().createValue(style->resize());
case CSSPropertyWebkitFontKerning:
- return cssValuePool.createValue(style->fontDescription().kerning());
+ return cssValuePool().createValue(style->fontDescription().kerning());
case CSSPropertyWebkitFontSmoothing:
- return cssValuePool.createValue(style->fontDescription().fontSmoothing());
- case CSSPropertyFontVariantLigatures:
- return fontVariantLigaturesPropertyValue(style->fontDescription().variantCommonLigatures(), style->fontDescription().variantDiscretionaryLigatures(), style->fontDescription().variantHistoricalLigatures(), style->fontDescription().variantContextualAlternates());
- case CSSPropertyFontVariantPosition:
- return fontVariantPositionPropertyValue(style->fontDescription().variantPosition());
- case CSSPropertyFontVariantCaps:
- return fontVariantCapsPropertyValue(style->fontDescription().variantCaps());
- case CSSPropertyFontVariantNumeric:
- return fontVariantNumericPropertyValue(style->fontDescription().variantNumericFigure(), style->fontDescription().variantNumericSpacing(), style->fontDescription().variantNumericFraction(), style->fontDescription().variantNumericOrdinal(), style->fontDescription().variantNumericSlashedZero());
- case CSSPropertyFontVariantAlternates:
- return fontVariantAlternatesPropertyValue(style->fontDescription().variantAlternates());
- case CSSPropertyFontVariantEastAsian:
- return fontVariantEastAsianPropertyValue(style->fontDescription().variantEastAsianVariant(), style->fontDescription().variantEastAsianWidth(), style->fontDescription().variantEastAsianRuby());
+ return cssValuePool().createValue(style->fontDescription().fontSmoothing());
+ case CSSPropertyWebkitFontVariantLigatures: {
+ FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
+ FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
+ FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
+ if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
+ && historicalLigaturesState == FontDescription::NormalLigaturesState)
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
+
+ RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
+ if (commonLigaturesState != FontDescription::NormalLigaturesState)
+ valueList->append(cssValuePool().createIdentifierValue(commonLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
+ if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
+ valueList->append(cssValuePool().createIdentifierValue(discretionaryLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryLigatures : CSSValueDiscretionaryLigatures));
+ if (historicalLigaturesState != FontDescription::NormalLigaturesState)
+ valueList->append(cssValuePool().createIdentifierValue(historicalLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatures : CSSValueHistoricalLigatures));
+ return valueList;
+ }
case CSSPropertyZIndex:
if (style->hasAutoZIndex())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyZoom:
- return cssValuePool.createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyBoxSizing:
if (style->boxSizing() == CONTENT_BOX)
- return cssValuePool.createIdentifierValue(CSSValueContentBox);
- return cssValuePool.createIdentifierValue(CSSValueBorderBox);
+ return cssValuePool().createIdentifierValue(CSSValueContentBox);
+ return cssValuePool().createIdentifierValue(CSSValueBorderBox);
#if ENABLE(DASHBOARD_SUPPORT)
case CSSPropertyWebkitDashboardRegion:
{
const Vector<StyleDashboardRegion>& regions = style->dashboardRegions();
unsigned count = regions.size();
if (count == 1 && regions[0].type == StyleDashboardRegion::None)
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
RefPtr<DashboardRegion> firstRegion;
- DashboardRegion* previousRegion = nullptr;
+ DashboardRegion* previousRegion = 0;
for (unsigned i = 0; i < count; i++) {
- auto region = DashboardRegion::create();
+ RefPtr<DashboardRegion> region = DashboardRegion::create();
StyleDashboardRegion styleRegion = regions[i];
region->m_label = styleRegion.label;
LengthBox offset = styleRegion.offset;
- region->setTop(zoomAdjustedPixelValue(offset.top().value(), *style));
- region->setRight(zoomAdjustedPixelValue(offset.right().value(), *style));
- region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), *style));
- region->setLeft(zoomAdjustedPixelValue(offset.left().value(), *style));
+ region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get()));
+ region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get()));
+ region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get()));
+ region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get()));
region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
if (previousRegion)
- previousRegion->m_next = region.copyRef();
+ previousRegion->m_next = region;
else
- firstRegion = region.copyRef();
- previousRegion = region.ptr();
+ firstRegion = region;
+ previousRegion = region.get();
}
- return cssValuePool.createValue(WTFMove(firstRegion));
+ return cssValuePool().createValue(firstRegion.release());
}
#endif
- case CSSPropertyAnimationDelay:
case CSSPropertyWebkitAnimationDelay:
return getDelayValue(style->animations());
- case CSSPropertyAnimationDirection:
case CSSPropertyWebkitAnimationDirection: {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
if (t) {
for (size_t i = 0; i < t->size(); ++i) {
- switch (t->animation(i).direction()) {
- case Animation::AnimationDirectionNormal:
- list->append(cssValuePool.createIdentifierValue(CSSValueNormal));
- break;
- case Animation::AnimationDirectionAlternate:
- list->append(cssValuePool.createIdentifierValue(CSSValueAlternate));
- break;
- case Animation::AnimationDirectionReverse:
- list->append(cssValuePool.createIdentifierValue(CSSValueReverse));
- break;
- case Animation::AnimationDirectionAlternateReverse:
- list->append(cssValuePool.createIdentifierValue(CSSValueAlternateReverse));
- break;
- }
+ if (t->animation(i).direction())
+ list->append(cssValuePool().createIdentifierValue(CSSValueAlternate));
+ else
+ list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
}
} else
- list->append(cssValuePool.createIdentifierValue(CSSValueNormal));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
+ return list.release();
}
- case CSSPropertyAnimationDuration:
case CSSPropertyWebkitAnimationDuration:
return getDurationValue(style->animations());
- case CSSPropertyAnimationFillMode:
case CSSPropertyWebkitAnimationFillMode: {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
@@ -3298,24 +2500,23 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
for (size_t i = 0; i < t->size(); ++i) {
switch (t->animation(i).fillMode()) {
case AnimationFillModeNone:
- list->append(cssValuePool.createIdentifierValue(CSSValueNone));
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
break;
case AnimationFillModeForwards:
- list->append(cssValuePool.createIdentifierValue(CSSValueForwards));
+ list->append(cssValuePool().createIdentifierValue(CSSValueForwards));
break;
case AnimationFillModeBackwards:
- list->append(cssValuePool.createIdentifierValue(CSSValueBackwards));
+ list->append(cssValuePool().createIdentifierValue(CSSValueBackwards));
break;
case AnimationFillModeBoth:
- list->append(cssValuePool.createIdentifierValue(CSSValueBoth));
+ list->append(cssValuePool().createIdentifierValue(CSSValueBoth));
break;
}
}
} else
- list->append(cssValuePool.createIdentifierValue(CSSValueNone));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ return list.release();
}
- case CSSPropertyAnimationIterationCount:
case CSSPropertyWebkitAnimationIterationCount: {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
@@ -3323,26 +2524,24 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
for (size_t i = 0; i < t->size(); ++i) {
double iterationCount = t->animation(i).iterationCount();
if (iterationCount == Animation::IterationCountInfinite)
- list->append(cssValuePool.createIdentifierValue(CSSValueInfinite));
+ list->append(cssValuePool().createIdentifierValue(CSSValueInfinite));
else
- list->append(cssValuePool.createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
+ list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
}
} else
- list->append(cssValuePool.createValue(Animation::initialIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
- return list;
+ list->append(cssValuePool().createValue(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
+ return list.release();
}
- case CSSPropertyAnimationName:
case CSSPropertyWebkitAnimationName: {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
if (t) {
for (size_t i = 0; i < t->size(); ++i)
- list->append(cssValuePool.createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
+ list->append(cssValuePool().createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
} else
- list->append(cssValuePool.createIdentifierValue(CSSValueNone));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ return list.release();
}
- case CSSPropertyAnimationPlayState:
case CSSPropertyWebkitAnimationPlayState: {
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
@@ -3350,33 +2549,24 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
for (size_t i = 0; i < t->size(); ++i) {
int prop = t->animation(i).playState();
if (prop == AnimPlayStatePlaying)
- list->append(cssValuePool.createIdentifierValue(CSSValueRunning));
+ list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
else
- list->append(cssValuePool.createIdentifierValue(CSSValuePaused));
+ list->append(cssValuePool().createIdentifierValue(CSSValuePaused));
}
} else
- list->append(cssValuePool.createIdentifierValue(CSSValueRunning));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
+ return list.release();
}
- case CSSPropertyAnimationTimingFunction:
case CSSPropertyWebkitAnimationTimingFunction:
return getTimingFunctionValue(style->animations());
-#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
- case CSSPropertyWebkitAnimationTrigger:
- return getAnimationTriggerValue(style->animations(), *style);
-#endif
case CSSPropertyWebkitAppearance:
- return cssValuePool.createValue(style->appearance());
+ return cssValuePool().createValue(style->appearance());
case CSSPropertyWebkitAspectRatio:
- if (style->aspectRatioType() == AspectRatioAuto)
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- if (style->aspectRatioType() == AspectRatioFromDimensions)
- return cssValuePool.createIdentifierValue(CSSValueFromDimensions);
- if (style->aspectRatioType() == AspectRatioFromIntrinsic)
- return cssValuePool.createIdentifierValue(CSSValueFromIntrinsic);
+ if (!style->hasAspectRatio())
+ return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
case CSSPropertyWebkitBackfaceVisibility:
- return cssValuePool.createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
+ return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
case CSSPropertyWebkitBorderImage:
return valueForNinePieceImage(style->borderImage());
case CSSPropertyBorderImageOutset:
@@ -3400,108 +2590,108 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWebkitMaskBoxImageSource:
if (style->maskBoxImageSource())
return style->maskBoxImageSource()->cssValue();
- return cssValuePool.createIdentifierValue(CSSValueNone);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
case CSSPropertyWebkitFontSizeDelta:
// Not a real style property -- used by the editing engine -- so has no computed value.
break;
- case CSSPropertyWebkitInitialLetter: {
- RefPtr<CSSPrimitiveValue> drop = !style->initialLetterDrop() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterDrop(), CSSPrimitiveValue::CSS_NUMBER);
- RefPtr<CSSPrimitiveValue> size = !style->initialLetterHeight() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterHeight(), CSSPrimitiveValue::CSS_NUMBER);
- return cssValuePool.createValue(Pair::create(drop.release(), size.release()));
- }
case CSSPropertyWebkitMarginBottomCollapse:
case CSSPropertyWebkitMarginAfterCollapse:
- return cssValuePool.createValue(style->marginAfterCollapse());
+ return cssValuePool().createValue(style->marginAfterCollapse());
case CSSPropertyWebkitMarginTopCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
- return cssValuePool.createValue(style->marginBeforeCollapse());
+ return cssValuePool().createValue(style->marginBeforeCollapse());
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
case CSSPropertyWebkitOverflowScrolling:
if (!style->useTouchOverflowScrolling())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- return cssValuePool.createIdentifierValue(CSSValueTouch);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return cssValuePool().createIdentifierValue(CSSValueTouch);
#endif
- case CSSPropertyPerspective:
+ case CSSPropertyWebkitPerspective:
if (!style->hasPerspective())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValue(style->perspective(), *style);
- case CSSPropertyPerspectiveOrigin: {
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return zoomAdjustedPixelValue(style->perspective(), style.get());
+ case CSSPropertyWebkitPerspectiveOrigin: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
LayoutRect box;
- if (is<RenderBox>(*renderer))
- box = downcast<RenderBox>(*renderer).borderBoxRect();
+ if (renderer->isBox())
+ box = toRenderBox(renderer)->borderBoxRect();
- list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width()), *style));
- list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height()), *style));
+ RenderView* renderView = m_node->document().renderView();
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
}
else {
- list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), *style));
- list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), *style));
+ list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
+ list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get()));
}
- return list;
+ return list.release();
}
case CSSPropertyWebkitRtlOrdering:
- return cssValuePool.createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
+ return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
+#if PLATFORM(IOS)
+ // FIXME: This property shouldn't be iOS-specific. Once we fix up its usage in InlineTextBox::paintCompositionBackground()
+ // we should remove the PLATFORM(IOS)-guard. See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
+ case CSSPropertyWebkitCompositionFillColor:
+ return currentColorOrValidColor(style.get(), style->compositionFillColor());
+#endif
#if ENABLE(TOUCH_EVENTS)
case CSSPropertyWebkitTapHighlightColor:
return currentColorOrValidColor(style.get(), style->tapHighlightColor());
- case CSSPropertyTouchAction:
- return cssValuePool.createValue(style->touchAction());
#endif
#if PLATFORM(IOS)
case CSSPropertyWebkitTouchCallout:
- return cssValuePool.createIdentifierValue(style->touchCalloutEnabled() ? CSSValueDefault : CSSValueNone);
+ return cssValuePool().createIdentifierValue(style->touchCalloutEnabled() ? CSSValueDefault : CSSValueNone);
#endif
case CSSPropertyWebkitUserDrag:
- return cssValuePool.createValue(style->userDrag());
+ return cssValuePool().createValue(style->userDrag());
case CSSPropertyWebkitUserSelect:
- return cssValuePool.createValue(style->userSelect());
+ return cssValuePool().createValue(style->userSelect());
case CSSPropertyBorderBottomLeftRadius:
- return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), *style);
+ return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document().renderView());
case CSSPropertyBorderBottomRightRadius:
- return getBorderRadiusCornerValue(style->borderBottomRightRadius(), *style);
+ return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document().renderView());
case CSSPropertyBorderTopLeftRadius:
- return getBorderRadiusCornerValue(style->borderTopLeftRadius(), *style);
+ return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document().renderView());
case CSSPropertyBorderTopRightRadius:
- return getBorderRadiusCornerValue(style->borderTopRightRadius(), *style);
+ return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document().renderView());
case CSSPropertyClip: {
if (!style->hasClip())
- return cssValuePool.createIdentifierValue(CSSValueAuto);
- auto rect = Rect::create();
- rect->setTop(autoOrZoomAdjustedValue(style->clip().top(), *style));
- rect->setRight(autoOrZoomAdjustedValue(style->clip().right(), *style));
- rect->setBottom(autoOrZoomAdjustedValue(style->clip().bottom(), *style));
- rect->setLeft(autoOrZoomAdjustedValue(style->clip().left(), *style));
- return cssValuePool.createValue(WTFMove(rect));
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ RefPtr<Rect> rect = Rect::create();
+ rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get()));
+ rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get()));
+ rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get()));
+ rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get()));
+ return cssValuePool().createValue(rect.release());
}
case CSSPropertySpeak:
- return cssValuePool.createValue(style->speak());
- case CSSPropertyTransform:
- return computedTransform(renderer, *style);
- case CSSPropertyTransformOrigin: {
+ return cssValuePool().createValue(style->speak());
+ case CSSPropertyWebkitTransform:
+ return computedTransform(renderer, style.get());
+ case CSSPropertyWebkitTransformOrigin: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
LayoutRect box;
- if (is<RenderBox>(*renderer))
- box = downcast<RenderBox>(*renderer).borderBoxRect();
+ if (renderer->isBox())
+ box = toRenderBox(renderer)->borderBoxRect();
- list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width()), *style));
- list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height()), *style));
+ RenderView* renderView = m_node->document().renderView();
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
if (style->transformOriginZ() != 0)
- list->append(zoomAdjustedPixelValue(style->transformOriginZ(), *style));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
} else {
- list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), *style));
- list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), *style));
+ list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get()));
+ list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get()));
if (style->transformOriginZ() != 0)
- list->append(zoomAdjustedPixelValue(style->transformOriginZ(), *style));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
}
- return list;
+ return list.release();
}
- case CSSPropertyTransformStyle:
case CSSPropertyWebkitTransformStyle:
- return cssValuePool.createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
+ return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
case CSSPropertyTransitionDelay:
case CSSPropertyWebkitTransitionDelay:
return getDelayValue(style->transitions());
@@ -3523,41 +2713,43 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
const Animation& animation = animList->animation(i);
list->append(createTransitionPropertyValue(animation));
- list->append(cssValuePool.createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
+ list->append(cssValuePool().createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
list->append(createTimingFunctionValue(animation.timingFunction().get()));
- list->append(cssValuePool.createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
- transitionsList->append(list.releaseNonNull());
+ list->append(cssValuePool().createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
+ transitionsList->append(list);
}
- return transitionsList;
+ return transitionsList.release();
}
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// transition-property default value.
- list->append(cssValuePool.createIdentifierValue(CSSValueAll));
- list->append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
- list->append(createTimingFunctionValue(Animation::initialTimingFunction().get()));
- list->append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
- return list;
+ list->append(cssValuePool().createIdentifierValue(CSSValueAll));
+ list->append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
+ list->append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
+ list->append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
+ return list.release();
}
case CSSPropertyPointerEvents:
- return cssValuePool.createValue(style->pointerEvents());
+ return cssValuePool().createValue(style->pointerEvents());
+ case CSSPropertyWebkitColorCorrection:
+ return cssValuePool().createValue(style->colorSpace());
case CSSPropertyWebkitLineGrid:
if (style->lineGrid().isNull())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return cssValuePool.createValue(style->lineGrid(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->lineGrid(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitLineSnap:
return CSSPrimitiveValue::create(style->lineSnap());
case CSSPropertyWebkitLineAlign:
return CSSPrimitiveValue::create(style->lineAlign());
case CSSPropertyWebkitWritingMode:
- return cssValuePool.createValue(style->writingMode());
+ return cssValuePool().createValue(style->writingMode());
case CSSPropertyWebkitTextCombine:
- return cssValuePool.createValue(style->textCombine());
+ return cssValuePool().createValue(style->textCombine());
case CSSPropertyWebkitTextOrientation:
return CSSPrimitiveValue::create(style->textOrientation());
case CSSPropertyWebkitLineBoxContain:
return createLineBoxContainValue(style->lineBoxContain());
- case CSSPropertyAlt:
+ case CSSPropertyWebkitAlt:
return altTextToCSSValue(style.get());
case CSSPropertyContent:
return contentToCSSValue(style.get());
@@ -3568,64 +2760,72 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWebkitClipPath: {
ClipPathOperation* operation = style->clipPath();
if (!operation)
- return cssValuePool.createIdentifierValue(CSSValueNone);
- if (is<ReferenceClipPathOperation>(*operation)) {
- const auto& referenceOperation = downcast<ReferenceClipPathOperation>(*operation);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+#if ENABLE(SVG)
+ if (operation->type() == ClipPathOperation::Reference) {
+ ReferenceClipPathOperation& referenceOperation = toReferenceClipPathOperation(*operation);
return CSSPrimitiveValue::create(referenceOperation.url(), CSSPrimitiveValue::CSS_URI);
}
+#endif
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (is<ShapeClipPathOperation>(*operation)) {
- const auto& shapeOperation = downcast<ShapeClipPathOperation>(*operation);
- list->append(valueForBasicShape(*style, shapeOperation.basicShape()));
+ if (operation->type() == ClipPathOperation::Shape) {
+ ShapeClipPathOperation& shapeOperation = toShapeClipPathOperation(*operation);
+ list->append(valueForBasicShape(style.get(), shapeOperation.basicShape()));
if (shapeOperation.referenceBox() != BoxMissing)
- list->append(cssValuePool.createValue(shapeOperation.referenceBox()));
+ list->append(cssValuePool().createValue(shapeOperation.referenceBox()));
}
- if (is<BoxClipPathOperation>(*operation)) {
- const auto& boxOperation = downcast<BoxClipPathOperation>(*operation);
- list->append(cssValuePool.createValue(boxOperation.referenceBox()));
+ if (operation->type() == ClipPathOperation::Box) {
+ BoxClipPathOperation& boxOperation = toBoxClipPathOperation(*operation);
+ list->append(cssValuePool().createValue(boxOperation.referenceBox()));
}
- return list;
+ return list.release();
}
#if ENABLE(CSS_REGIONS)
case CSSPropertyWebkitFlowInto:
- if (!style->hasFlowInto())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return cssValuePool.createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
+ if (style->flowThread().isNull())
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitFlowFrom:
if (!style->hasFlowFrom())
- return cssValuePool.createIdentifierValue(CSSValueNone);
- return cssValuePool.createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING);
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING);
case CSSPropertyWebkitRegionFragment:
- return cssValuePool.createValue(style->regionFragment());
+ return cssValuePool().createValue(style->regionFragment());
+#endif
+#if ENABLE(CSS_EXCLUSIONS)
+ case CSSPropertyWebkitWrapFlow:
+ return cssValuePool().createValue(style->wrapFlow());
+ case CSSPropertyWebkitWrapThrough:
+ return cssValuePool().createValue(style->wrapThrough());
#endif
#if ENABLE(CSS_SHAPES)
case CSSPropertyWebkitShapeMargin:
- return cssValuePool.createValue(style->shapeMargin(), *style);
+ return cssValuePool().createValue(style->shapeMargin());
+ case CSSPropertyWebkitShapePadding:
+ return cssValuePool().createValue(style->shapePadding());
case CSSPropertyWebkitShapeImageThreshold:
- return cssValuePool.createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
+ case CSSPropertyWebkitShapeInside:
+ return shapePropertyValue(style.get(), style->shapeInside());
case CSSPropertyWebkitShapeOutside:
- return shapePropertyValue(*style, style->shapeOutside());
+ return shapePropertyValue(style.get(), style->shapeOutside());
#endif
- case CSSPropertyFilter:
- return valueForFilter(*style, style->filter());
-#if ENABLE(FILTERS_LEVEL_2)
- case CSSPropertyWebkitBackdropFilter:
- return valueForFilter(*style, style->backdropFilter());
+#if ENABLE(CSS_FILTERS)
+ case CSSPropertyWebkitFilter:
+ return valueForFilter(style.get(), style->filter());
#endif
#if ENABLE(CSS_COMPOSITING)
- case CSSPropertyMixBlendMode:
- return cssValuePool.createValue(style->blendMode());
- case CSSPropertyIsolation:
- return cssValuePool.createValue(style->isolation());
+ case CSSPropertyWebkitBlendMode:
+ return cssValuePool().createValue(style->blendMode());
#endif
- case CSSPropertyBackgroundBlendMode: {
+ case CSSPropertyWebkitBackgroundBlendMode: {
const FillLayer* layers = style->backgroundLayers();
if (!layers->next())
- return cssValuePool.createValue(layers->blendMode());
+ return cssValuePool().createValue(layers->blendMode());
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(cssValuePool.createValue(currLayer->blendMode()));
+ list->append(cssValuePool().createValue(currLayer->blendMode()));
return list.release();
}
@@ -3633,12 +2833,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
return getBackgroundShorthandValue();
case CSSPropertyBorder: {
RefPtr<CSSValue> value = propertyValue(CSSPropertyBorderTop, DoNotUpdateLayout);
- const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
- for (auto& property : properties) {
- if (!compareCSSValuePtr<CSSValue>(value, propertyValue(property, DoNotUpdateLayout)))
- return nullptr;
+ const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
+ CSSPropertyBorderLeft };
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
+ if (!compareCSSValuePtr<CSSValue>(value, propertyValue(properties[i], DoNotUpdateLayout)))
+ return 0;
}
- return value;
+ return value.release();
}
case CSSPropertyBorderBottom:
return getCSSPropertyValuesForShorthandProperties(borderBottomShorthand());
@@ -3649,7 +2850,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyBorderImage:
return valueForNinePieceImage(style->borderImage());
case CSSPropertyBorderRadius:
- return getBorderRadiusShorthandValue(*style);
+ return getBorderRadiusShorthandValue(style.get(), m_node->document().renderView());
case CSSPropertyBorderRight:
return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
case CSSPropertyBorderStyle:
@@ -3658,10 +2859,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
return getCSSPropertyValuesForShorthandProperties(borderTopShorthand());
case CSSPropertyBorderWidth:
return getCSSPropertyValuesForSidesShorthand(borderWidthShorthand());
- case CSSPropertyColumnRule:
- return getCSSPropertyValuesForShorthandProperties(columnRuleShorthand());
- case CSSPropertyColumns:
- return getCSSPropertyValuesForShorthandProperties(columnsShorthand());
+ case CSSPropertyWebkitColumnRule:
+ return getCSSPropertyValuesForShorthandProperties(webkitColumnRuleShorthand());
+ case CSSPropertyWebkitColumns:
+ return getCSSPropertyValuesForShorthandProperties(webkitColumnsShorthand());
case CSSPropertyListStyle:
return getCSSPropertyValuesForShorthandProperties(listStyleShorthand());
case CSSPropertyMargin:
@@ -3670,55 +2871,12 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
return getCSSPropertyValuesForShorthandProperties(outlineShorthand());
case CSSPropertyPadding:
return getCSSPropertyValuesForSidesShorthand(paddingShorthand());
-
-#if ENABLE(CSS_SCROLL_SNAP)
- case CSSPropertyWebkitScrollSnapType:
- return cssValuePool.createValue(style->scrollSnapType());
- case CSSPropertyWebkitScrollSnapDestination:
- return scrollSnapDestination(*style, style->scrollSnapDestination());
- case CSSPropertyWebkitScrollSnapPointsX:
- return scrollSnapPoints(*style, style->scrollSnapPointsX());
- case CSSPropertyWebkitScrollSnapPointsY:
- return scrollSnapPoints(*style, style->scrollSnapPointsY());
- case CSSPropertyWebkitScrollSnapCoordinate:
- return scrollSnapCoordinates(*style, style->scrollSnapCoordinates());
-#endif
-
-#if ENABLE(CSS_TRAILING_WORD)
- case CSSPropertyAppleTrailingWord:
- return cssValuePool.createValue(style->trailingWord());
-#endif
-
/* Individual properties not part of the spec */
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
break;
- // Length properties for SVG.
- case CSSPropertyCx:
- return zoomAdjustedPixelValueForLength(style->svgStyle().cx(), *style);
- case CSSPropertyCy:
- return zoomAdjustedPixelValueForLength(style->svgStyle().cy(), *style);
- case CSSPropertyR:
- return zoomAdjustedPixelValueForLength(style->svgStyle().r(), *style);
- case CSSPropertyRx:
- return zoomAdjustedPixelValueForLength(style->svgStyle().rx(), *style);
- case CSSPropertyRy:
- return zoomAdjustedPixelValueForLength(style->svgStyle().ry(), *style);
- case CSSPropertyStrokeWidth:
- return zoomAdjustedPixelValueForLength(style->svgStyle().strokeWidth(), *style);
- case CSSPropertyStrokeDashoffset:
- return zoomAdjustedPixelValueForLength(style->svgStyle().strokeDashOffset(), *style);
- case CSSPropertyX:
- return zoomAdjustedPixelValueForLength(style->svgStyle().x(), *style);
- case CSSPropertyY:
- return zoomAdjustedPixelValueForLength(style->svgStyle().y(), *style);
- case CSSPropertyWebkitTextZoom:
- return cssValuePool.createValue(style->textZoom());
-
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
- case CSSPropertyAll:
- case CSSPropertyAnimation:
case CSSPropertyWebkitTextEmphasis:
case CSSPropertyTextLineThrough:
case CSSPropertyTextLineThroughColor:
@@ -3792,12 +2950,12 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWebkitMask:
case CSSPropertyWebkitMaskRepeatX:
case CSSPropertyWebkitMaskRepeatY:
- case CSSPropertyPerspectiveOriginX:
- case CSSPropertyPerspectiveOriginY:
+ case CSSPropertyWebkitPerspectiveOriginX:
+ case CSSPropertyWebkitPerspectiveOriginY:
case CSSPropertyWebkitTextStroke:
- case CSSPropertyTransformOriginX:
- case CSSPropertyTransformOriginY:
- case CSSPropertyTransformOriginZ:
+ case CSSPropertyWebkitTransformOriginX:
+ case CSSPropertyWebkitTransformOriginY:
+ case CSSPropertyWebkitTransformOriginZ:
break;
#if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -3808,11 +2966,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
break;
#endif
+#if ENABLE(SVG)
case CSSPropertyBufferedRendering:
case CSSPropertyClipPath:
case CSSPropertyClipRule:
case CSSPropertyMask:
case CSSPropertyEnableBackground:
+ case CSSPropertyFilter:
case CSSPropertyFloodColor:
case CSSPropertyFloodOpacity:
case CSSPropertyLightingColor:
@@ -3830,14 +2990,15 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyMarkerMid:
case CSSPropertyMarkerStart:
case CSSPropertyMaskType:
- case CSSPropertyPaintOrder:
case CSSPropertyShapeRendering:
case CSSPropertyStroke:
case CSSPropertyStrokeDasharray:
+ case CSSPropertyStrokeDashoffset:
case CSSPropertyStrokeLinecap:
case CSSPropertyStrokeLinejoin:
case CSSPropertyStrokeMiterlimit:
case CSSPropertyStrokeOpacity:
+ case CSSPropertyStrokeWidth:
case CSSPropertyAlignmentBaseline:
case CSSPropertyBaselineShift:
case CSSPropertyDominantBaseline:
@@ -3849,21 +3010,19 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
case CSSPropertyWritingMode:
case CSSPropertyWebkitSvgShadow:
return svgPropertyValue(propertyID, DoNotUpdateLayout);
- case CSSPropertyCustom:
- ASSERT_NOT_REACHED();
- return nullptr;
+#endif
}
logUnimplementedPropertyID(propertyID);
- return nullptr;
+ return 0;
}
String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
{
RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
- if (!value)
- return emptyString(); // FIXME: Should this be null instead, as it is in StyleProperties::getPropertyValue?
- return value->cssText();
+ if (value)
+ return value->cssText();
+ return "";
}
unsigned CSSComputedStyleDeclaration::length() const
@@ -3876,68 +3035,49 @@ unsigned CSSComputedStyleDeclaration::length() const
if (!style)
return 0;
- return numComputedProperties + style->customProperties().size();
+ return numComputedProperties;
}
String CSSComputedStyleDeclaration::item(unsigned i) const
{
if (i >= length())
- return emptyString();
-
- if (i < numComputedProperties)
- return getPropertyNameString(computedProperties[i]);
-
- Node* node = m_node.get();
- if (!node)
- return emptyString();
+ return "";
- RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
- if (!style)
- return emptyString();
-
- unsigned index = i - numComputedProperties;
-
- const auto& customProperties = style->customProperties();
- if (index >= customProperties.size())
- return emptyString();
-
- Vector<String, 4> results;
- copyKeysToVector(customProperties, results);
- return results.at(index);
+ return getPropertyNameString(computedProperties[i]);
}
bool ComputedStyleExtractor::propertyMatches(CSSPropertyID propertyID, const CSSValue* value) const
{
- if (propertyID == CSSPropertyFontSize && is<CSSPrimitiveValue>(*value) && m_node) {
+ if (propertyID == CSSPropertyFontSize && value->isPrimitiveValue() && m_node) {
m_node->document().updateLayoutIgnorePendingStylesheets();
- if (RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier)) {
- if (CSSValueID sizeIdentifier = style->fontDescription().keywordSizeAsIdentifier()) {
- auto& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- if (primitiveValue.isValueID() && primitiveValue.getValueID() == sizeIdentifier)
- return true;
- }
+ RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier);
+ if (style && style->fontDescription().keywordSize()) {
+ CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize());
+ const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue->isValueID() && primitiveValue->getValueID() == sizeValue)
+ return true;
}
}
RefPtr<CSSValue> computedValue = propertyValue(propertyID);
return computedValue && value && computedValue->equals(*value);
}
-Ref<MutableStyleProperties> ComputedStyleExtractor::copyProperties() const
+PassRef<MutableStyleProperties> ComputedStyleExtractor::copyProperties() const
{
return copyPropertiesInSet(computedProperties, numComputedProperties);
}
-RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand& shorthand) const
+PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand& shorthand) const
{
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
- list->append(value.releaseNonNull());
+ list->append(value);
}
- return list;
+ return list.release();
}
-RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
+PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
{
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// Assume the properties are in the usual order top, right, bottom, left.
@@ -3948,34 +3088,34 @@ RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShortha
// All 4 properties must be specified.
if (!topValue || !rightValue || !bottomValue || !leftValue)
- return nullptr;
+ return 0;
bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
- list->append(topValue.releaseNonNull());
+ list->append(topValue.release());
if (showRight)
- list->append(rightValue.releaseNonNull());
+ list->append(rightValue.release());
if (showBottom)
- list->append(bottomValue.releaseNonNull());
+ list->append(bottomValue.release());
if (showLeft)
- list->append(leftValue.releaseNonNull());
+ list->append(leftValue.release());
- return list;
+ return list.release();
}
-RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand& shorthand) const
+PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand& shorthand) const
{
RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
- list->append(value.releaseNonNull());
+ list->append(value.release());
}
- return list;
+ return list.release();
}
-Ref<MutableStyleProperties> ComputedStyleExtractor::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
+PassRef<MutableStyleProperties> ComputedStyleExtractor::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
{
Vector<CSSProperty, 256> list;
list.reserveInitialCapacity(length);
@@ -3989,26 +3129,20 @@ Ref<MutableStyleProperties> ComputedStyleExtractor::copyPropertiesInSet(const CS
CSSRule* CSSComputedStyleDeclaration::parentRule() const
{
- return nullptr;
+ return 0;
}
-RefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
{
- if (isCustomPropertyName(propertyName))
- return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).customPropertyValue(propertyName);
-
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
- return nullptr;
+ return 0;
RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
- return value ? value->cloneForCSSOM() : nullptr;
+ return value ? value->cloneForCSSOM() : 0;
}
String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
{
- if (isCustomPropertyName(propertyName))
- return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).customPropertyText(propertyName);
-
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
@@ -4018,12 +3152,12 @@ String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
String CSSComputedStyleDeclaration::getPropertyPriority(const String&)
{
// All computed styles have a priority of not "important".
- return emptyString(); // FIXME: Should this sometimes be null instead of empty, to match a normal style declaration?
+ return "";
}
String CSSComputedStyleDeclaration::getPropertyShorthand(const String&)
{
- return emptyString(); // FIXME: Should this sometimes be null instead of empty, to match a normal style declaration?
+ return "";
}
bool CSSComputedStyleDeclaration::isPropertyImplicit(const String&)
@@ -4042,7 +3176,7 @@ String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionCode&
return String();
}
-RefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
{
return getPropertyCSSValue(propertyID);
}
@@ -4052,13 +3186,12 @@ String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope
return getPropertyValue(propertyID);
}
-bool CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
+void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
{
ec = NO_MODIFICATION_ALLOWED_ERR;
- return false;
}
-RefPtr<CSSValueList> ComputedStyleExtractor::getBackgroundShorthandValue() const
+PassRefPtr<CSSValueList> ComputedStyleExtractor::getBackgroundShorthandValue() const
{
static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,
@@ -4067,9 +3200,9 @@ RefPtr<CSSValueList> ComputedStyleExtractor::getBackgroundShorthandValue() const
CSSPropertyBackgroundClip };
RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
- list->append(*getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator)));
- list->append(*getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator)));
- return list;
+ list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
+ list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
+ return list.release();
}
} // namespace WebCore