#include "config.h"
#include "core/css/CSSComputedStyleDeclaration.h"
-#include "CSSPropertyNames.h"
-#include "FontFamilyNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "StylePropertyShorthand.h"
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "core/CSSPropertyNames.h"
+#include "core/StylePropertyShorthand.h"
+#include "core/animation/DocumentAnimations.h"
#include "core/css/BasicShapeFunctions.h"
-#include "core/css/CSSArrayFunctionValue.h"
#include "core/css/CSSAspectRatioValue.h"
#include "core/css/CSSBorderImage.h"
#include "core/css/CSSFilterValue.h"
#include "core/css/CSSFontFeatureValue.h"
#include "core/css/CSSFontValue.h"
#include "core/css/CSSFunctionValue.h"
-#include "core/css/CSSGridTemplateValue.h"
+#include "core/css/CSSGridLineNamesValue.h"
+#include "core/css/CSSGridTemplateAreasValue.h"
#include "core/css/CSSLineBoxContainValue.h"
-#include "core/css/CSSMixFunctionValue.h"
-#include "core/css/CSSParser.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/css/CSSPropertyMetadata.h"
#include "core/css/CSSReflectValue.h"
#include "core/css/CSSSelector.h"
#include "core/css/CSSShadowValue.h"
#include "core/css/Pair.h"
#include "core/css/Rect.h"
#include "core/css/StylePropertySet.h"
+#include "core/css/parser/CSSParser.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/PseudoElement.h"
-#include "core/page/RuntimeCSSEnabled.h"
-#include "core/frame/animation/AnimationController.h"
#include "core/rendering/RenderBox.h"
#include "core/rendering/RenderGrid.h"
-#include "core/rendering/RenderView.h"
#include "core/rendering/style/ContentData.h"
#include "core/rendering/style/CounterContent.h"
-#include "core/rendering/style/CursorList.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/style/ShadowList.h"
#include "core/rendering/style/ShapeValue.h"
+#include "platform/FontFamilyNames.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/fonts/FontFeatureSettings.h"
#include "wtf/text/StringBuilder.h"
-#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
-#include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h"
-#include "core/rendering/style/StyleCustomFilterProgram.h"
-#include "platform/graphics/filters/custom/CustomFilterArrayParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterNumberParameter.h"
-#include "platform/graphics/filters/custom/CustomFilterParameter.h"
-
-namespace WebCore {
+namespace blink {
// List of all properties we know how to compute, omitting shorthands.
// NOTE: Do not use this list, use computableProperties() instead
CSSPropertyEmptyCells,
CSSPropertyFloat,
CSSPropertyFontFamily,
+ CSSPropertyFontKerning,
CSSPropertyFontSize,
+ CSSPropertyFontStretch,
CSSPropertyFontStyle,
CSSPropertyFontVariant,
+ CSSPropertyFontVariantLigatures,
CSSPropertyFontWeight,
CSSPropertyHeight,
CSSPropertyImageRendering,
CSSPropertyIsolation,
+ CSSPropertyJustifyItems,
+ CSSPropertyJustifySelf,
CSSPropertyLeft,
CSSPropertyLetterSpacing,
CSSPropertyLineHeight,
CSSPropertyPosition,
CSSPropertyResize,
CSSPropertyRight,
+ CSSPropertyScrollBehavior,
CSSPropertySpeak,
CSSPropertyTableLayout,
CSSPropertyTabSize,
CSSPropertyWhiteSpace,
CSSPropertyWidows,
CSSPropertyWidth,
+ CSSPropertyWillChange,
CSSPropertyWordBreak,
CSSPropertyWordSpacing,
CSSPropertyWordWrap,
CSSPropertyWebkitAnimationPlayState,
CSSPropertyWebkitAnimationTimingFunction,
CSSPropertyWebkitAppearance,
+ CSSPropertyBackfaceVisibility,
CSSPropertyWebkitBackfaceVisibility,
CSSPropertyWebkitBackgroundClip,
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitColumnBreakAfter,
CSSPropertyWebkitColumnBreakBefore,
CSSPropertyWebkitColumnBreakInside,
- CSSPropertyWebkitColumnAxis,
CSSPropertyWebkitColumnCount,
CSSPropertyWebkitColumnGap,
- CSSPropertyWebkitColumnProgression,
CSSPropertyWebkitColumnRuleColor,
CSSPropertyWebkitColumnRuleStyle,
CSSPropertyWebkitColumnRuleWidth,
CSSPropertyFlexDirection,
CSSPropertyFlexWrap,
CSSPropertyJustifyContent,
- CSSPropertyWebkitFontKerning,
CSSPropertyWebkitFontSmoothing,
- CSSPropertyWebkitFontVariantLigatures,
CSSPropertyGridAutoColumns,
CSSPropertyGridAutoFlow,
CSSPropertyGridAutoRows,
CSSPropertyGridColumnEnd,
CSSPropertyGridColumnStart,
- CSSPropertyGridDefinitionColumns,
- CSSPropertyGridDefinitionRows,
+ CSSPropertyGridTemplateAreas,
+ CSSPropertyGridTemplateColumns,
+ CSSPropertyGridTemplateRows,
CSSPropertyGridRowEnd,
CSSPropertyGridRowStart,
CSSPropertyWebkitHighlight,
CSSPropertyWebkitHyphenateCharacter,
- CSSPropertyWebkitLineAlign,
CSSPropertyWebkitLineBoxContain,
CSSPropertyWebkitLineBreak,
CSSPropertyWebkitLineClamp,
- CSSPropertyWebkitLineGrid,
- CSSPropertyWebkitLineSnap,
CSSPropertyWebkitLocale,
CSSPropertyWebkitMarginBeforeCollapse,
CSSPropertyWebkitMarginAfterCollapse,
CSSPropertyWebkitMaskRepeat,
CSSPropertyWebkitMaskSize,
CSSPropertyOrder,
+ CSSPropertyPerspective,
CSSPropertyWebkitPerspective,
+ CSSPropertyPerspectiveOrigin,
CSSPropertyWebkitPerspectiveOrigin,
CSSPropertyWebkitPrintColorAdjust,
CSSPropertyWebkitRtlOrdering,
- CSSPropertyShapeInside,
CSSPropertyShapeOutside,
- CSSPropertyShapePadding,
CSSPropertyShapeImageThreshold,
CSSPropertyShapeMargin,
CSSPropertyWebkitTapHighlightColor,
CSSPropertyWebkitTextSecurity,
CSSPropertyWebkitTextStrokeColor,
CSSPropertyWebkitTextStrokeWidth,
+ CSSPropertyTransform,
CSSPropertyWebkitTransform,
+ CSSPropertyTransformOrigin,
CSSPropertyWebkitTransformOrigin,
+ CSSPropertyTransformStyle,
CSSPropertyWebkitTransformStyle,
CSSPropertyWebkitTransitionDelay,
CSSPropertyWebkitTransitionDuration,
CSSPropertyWebkitUserModify,
CSSPropertyWebkitUserSelect,
CSSPropertyWebkitWritingMode,
- CSSPropertyWebkitFlowInto,
- CSSPropertyWebkitFlowFrom,
- CSSPropertyWebkitRegionBreakAfter,
- CSSPropertyWebkitRegionBreakBefore,
- CSSPropertyWebkitRegionBreakInside,
- CSSPropertyWebkitRegionFragment,
CSSPropertyWebkitAppRegion,
- CSSPropertyWebkitWrapFlow,
- CSSPropertyWebkitWrapThrough,
CSSPropertyBufferedRendering,
CSSPropertyClipPath,
CSSPropertyClipRule,
CSSPropertyAlignmentBaseline,
CSSPropertyBaselineShift,
CSSPropertyDominantBaseline,
- CSSPropertyKerning,
CSSPropertyTextAnchor,
CSSPropertyWritingMode,
CSSPropertyGlyphOrientationHorizontal,
{
DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
if (properties.isEmpty())
- RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticComputableProperties, WTF_ARRAY_LENGTH(staticComputableProperties), properties);
+ CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(staticComputableProperties, WTF_ARRAY_LENGTH(staticComputableProperties), properties);
return properties;
}
}
}
-static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
+static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
{
// Create the slices.
- RefPtr<CSSPrimitiveValue> top;
- RefPtr<CSSPrimitiveValue> right;
- RefPtr<CSSPrimitiveValue> bottom;
- RefPtr<CSSPrimitiveValue> left;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
if (image.imageSlices().top().isPercent())
top = cssValuePool().createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
}
}
- RefPtr<Quad> quad = Quad::create();
+ RefPtrWillBeRawPtr<Quad> quad = Quad::create();
quad->setTop(top);
quad->setRight(right);
quad->setBottom(bottom);
return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.release()), image.fill());
}
-static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const BorderImageLengthBox& box, const RenderStyle& style)
{
// Create the slices.
- RefPtr<CSSPrimitiveValue> top;
- RefPtr<CSSPrimitiveValue> right;
- RefPtr<CSSPrimitiveValue> bottom;
- RefPtr<CSSPrimitiveValue> left;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
- if (box.top().isRelative())
- top = cssValuePool().createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
+ if (box.top().isNumber())
+ top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::CSS_NUMBER);
else
- top = cssValuePool().createValue(box.top(), style);
+ top = cssValuePool().createValue(box.top().length(), style);
if (box.right() == box.top() && box.bottom() == box.top() && box.left() == box.top()) {
right = top;
bottom = top;
left = top;
} else {
- if (box.right().isRelative())
- right = cssValuePool().createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
+ if (box.right().isNumber())
+ right = cssValuePool().createValue(box.right().number(), CSSPrimitiveValue::CSS_NUMBER);
else
- right = cssValuePool().createValue(box.right(), style);
+ right = cssValuePool().createValue(box.right().length(), style);
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);
+ if (box.bottom().isNumber())
+ bottom = cssValuePool().createValue(box.bottom().number(), CSSPrimitiveValue::CSS_NUMBER);
else
- bottom = cssValuePool().createValue(box.bottom(), style);
+ bottom = cssValuePool().createValue(box.bottom().length(), style);
if (box.left() == box.right())
left = right;
else {
- if (box.left().isRelative())
- left = cssValuePool().createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
+ if (box.left().isNumber())
+ left = cssValuePool().createValue(box.left().number(), CSSPrimitiveValue::CSS_NUMBER);
else
- left = cssValuePool().createValue(box.left(), style);
+ left = cssValuePool().createValue(box.left().length(), style);
}
}
}
- RefPtr<Quad> quad = Quad::create();
+ RefPtrWillBeRawPtr<Quad> quad = Quad::create();
quad->setTop(top);
quad->setRight(right);
quad->setBottom(bottom);
return cssValuePool().createValue(quad.release());
}
-static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
{
- RefPtr<CSSPrimitiveValue> horizontalRepeat;
- RefPtr<CSSPrimitiveValue> verticalRepeat;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr;
horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
if (image.horizontalRule() == image.verticalRule())
return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release(), Pair::DropIdenticalValues));
}
-static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle& style)
{
if (!image.hasImage())
return cssValuePool().createIdentifierValue(CSSValueNone);
// Image first.
- RefPtr<CSSValue> imageValue;
+ RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr;
if (image.image())
imageValue = image.image()->cssValue();
// Create the image slice.
- RefPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(image);
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(image);
// Create the border area slices.
- RefPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices(), style);
+ RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices(), style);
// Create the border outset.
- RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style);
+ RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style);
// Create the repeat rules.
- RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
+ RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
return createBorderImageValue(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat.release());
}
-inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle& style)
{
return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
}
-inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle& style)
{
- return cssValuePool().createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
+ return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
}
-static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle& style)
{
if (length.isFixed())
return zoomAdjustedPixelValue(length.value(), style);
return cssValuePool().createValue(length, style);
}
-static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle& style)
{
if (!reflection)
return cssValuePool().createIdentifierValue(CSSValueNone);
- RefPtr<CSSPrimitiveValue> offset;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr;
if (reflection->offset().isPercent())
offset = cssValuePool().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
else
offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
- RefPtr<CSSPrimitiveValue> direction;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr;
switch (reflection->direction()) {
case ReflectionBelow:
direction = cssValuePool().createIdentifierValue(CSSValueBelow);
return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask(), style));
}
-static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer& layer, const RenderStyle& style)
{
- ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
- RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
- positionList->append(cssValuePool().createValue(layer->backgroundXOrigin()));
- positionList->append(zoomAdjustedPixelValueForLength(layer->xPosition(), style));
- positionList->append(cssValuePool().createValue(layer->backgroundYOrigin()));
- positionList->append(zoomAdjustedPixelValueForLength(layer->yPosition(), style));
+ RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
+ if (layer.isBackgroundXOriginSet()) {
+ ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
+ positionList->append(cssValuePool().createValue(layer.backgroundXOrigin()));
+ }
+ positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), style));
+ if (layer.isBackgroundYOriginSet()) {
+ ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
+ positionList->append(cssValuePool().createValue(layer.backgroundYOrigin()));
+ }
+ positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), style));
return positionList.release();
}
-static PassRefPtr<CSSValue> valueForPositionOffset(RenderStyle* style, CSSPropertyID propertyID, const RenderObject* renderer, RenderView* renderView)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(RenderStyle& style, CSSPropertyID propertyID, const RenderObject* renderer)
{
- if (!style)
- return 0;
-
Length l;
switch (propertyID) {
case CSSPropertyLeft:
- l = style->left();
+ l = style.left();
break;
case CSSPropertyRight:
- l = style->right();
+ l = style.right();
break;
case CSSPropertyTop:
- l = style->top();
+ l = style.top();
break;
case CSSPropertyBottom:
- l = style->bottom();
+ l = style.bottom();
break;
default:
- return 0;
+ return nullptr;
}
if (l.isPercent() && renderer && renderer->isBox()) {
LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) ?
toRenderBox(renderer)->containingBlockLogicalWidthForContent() :
toRenderBox(renderer)->containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding);
- return zoomAdjustedPixelValue(valueForLength(l, containingBlockSize, 0), style);
+ return zoomAdjustedPixelValue(valueForLength(l, containingBlockSize), style);
}
- if (l.isViewportPercentage())
- return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
if (l.isAuto()) {
// 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().createValue(l);
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
}
return zoomAdjustedPixelValueForLength(l, style);
}
-PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(const RenderStyle* style, const Color& color) const
+PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(const RenderStyle& style, const StyleColor& color) const
{
// This function does NOT look at visited information, so that computed style doesn't expose that.
- if (!color.isValid())
- return cssValuePool().createColorValue(style->color().rgb());
- return cssValuePool().createColorValue(color.rgb());
+ return cssValuePool().createColorValue(color.resolve(style.color()).rgb());
}
-static PassRefPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, const RenderStyle& style)
{
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (radius.width().type() == Percent)
list->append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
else
return list.release();
}
-static PassRefPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const RenderStyle& style)
{
- RefPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style);
+ RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style);
if (list->item(0)->equals(*list->item(1)))
return list->item(0);
return list.release();
}
-static PassRefPtr<CSSValueList> valueForBorderRadiusShorthand(const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const RenderStyle& style)
{
- RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> 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 = valuesForBorderRadiusCorner(style->borderTopLeftRadius(), style);
- RefPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorner(style->borderTopRightRadius(), style);
- RefPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCorner(style->borderBottomRightRadius(), style);
- RefPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCorner(style->borderBottomLeftRadius(), style);
+ RefPtrWillBeRawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner(style.borderTopLeftRadius(), style);
+ RefPtrWillBeRawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorner(style.borderTopRightRadius(), style);
+ RefPtrWillBeRawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCorner(style.borderBottomRightRadius(), style);
+ RefPtrWillBeRawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCorner(style.borderBottomLeftRadius(), style);
- RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
horizontalRadii->append(topLeftRadius->item(0));
if (showHorizontalTopRight)
horizontalRadii->append(topRightRadius->item(0));
list->append(horizontalRadii.release());
- RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
verticalRadii->append(topLeftRadius->item(1));
if (showVerticalTopRight)
verticalRadii->append(topRightRadius->item(1));
return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
}
-static PassRefPtr<CSSTransformValue> valueForMatrixTransform(const TransformationMatrix& transform, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSTransformValue> valueForMatrixTransform(const TransformationMatrix& transform, const RenderStyle& style)
{
- RefPtr<CSSTransformValue> transformValue;
+ RefPtrWillBeRawPtr<CSSTransformValue> transformValue = nullptr;
if (transform.isAffine()) {
transformValue = CSSTransformValue::create(CSSTransformValue::MatrixTransformOperation);
return transformValue.release();
}
-static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle& style)
{
- if (!renderer || !renderer->hasTransform() || !style->hasTransform())
+ if (!renderer || !renderer->hasTransform() || !style.hasTransform())
return cssValuePool().createIdentifierValue(CSSValueNone);
IntRect box;
box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect());
TransformationMatrix transform;
- style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
+ style.applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
// FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(valueForMatrixTransform(transform, style));
return list.release();
}
-static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilterArrayParameter* arrayParameter)
-{
- RefPtr<CSSArrayFunctionValue> arrayParameterValue = CSSArrayFunctionValue::create();
- for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i)
- arrayParameterValue->append(cssValuePool().createValue(arrayParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
- return arrayParameterValue.release();
-}
-
-static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter)
-{
- RefPtr<CSSValueList> numberParameterValue = CSSValueList::createSpaceSeparated();
- for (unsigned i = 0; i < numberParameter->size(); ++i)
- numberParameterValue->append(cssValuePool().createValue(numberParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
- return numberParameterValue.release();
-}
-
-static PassRefPtr<CSSValue> valueForCustomFilterTransformParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterTransformParameter* transformParameter)
-{
- IntSize size;
- if (renderer && renderer->isBox())
- size = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size();
-
- TransformationMatrix transform;
- transformParameter->applyTransform(transform, size);
- // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
- return valueForMatrixTransform(transform, style);
-}
-
-static PassRefPtr<CSSValue> valueForCustomFilterParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterParameter* parameter)
-{
- // FIXME: Add here computed style for the other types: boolean, transform, matrix, texture.
- ASSERT(parameter);
- switch (parameter->parameterType()) {
- case CustomFilterParameter::Array:
- return valueForCustomFilterArrayParameter(static_cast<const CustomFilterArrayParameter*>(parameter));
- case CustomFilterParameter::Number:
- return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter));
- case CustomFilterParameter::Transform:
- return valueForCustomFilterTransformParameter(renderer, style, static_cast<const CustomFilterTransformParameter*>(parameter));
- }
-
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObject* renderer, const RenderStyle* style) const
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObject* renderer, const RenderStyle& style) const
{
- if (style->filter().operations().isEmpty())
+ if (style.filter().operations().isEmpty())
return cssValuePool().createIdentifierValue(CSSValueNone);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- RefPtr<CSSFilterValue> filterValue;
+ RefPtrWillBeRawPtr<CSSFilterValue> filterValue = nullptr;
- Vector<RefPtr<FilterOperation> >::const_iterator end = style->filter().operations().end();
- for (Vector<RefPtr<FilterOperation> >::const_iterator it = style->filter().operations().begin(); it != end; ++it) {
- FilterOperation* filterOperation = (*it).get();
- switch (filterOperation->getOperationType()) {
- case FilterOperation::REFERENCE: {
- ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
+ Vector<RefPtr<FilterOperation> >::const_iterator end = style.filter().operations().end();
+ for (Vector<RefPtr<FilterOperation> >::const_iterator it = style.filter().operations().begin(); it != end; ++it) {
+ FilterOperation* filterOperation = it->get();
+ switch (filterOperation->type()) {
+ case FilterOperation::REFERENCE:
filterValue = CSSFilterValue::create(CSSFilterValue::ReferenceFilterOperation);
- filterValue->append(cssValuePool().createValue(referenceOperation->url(), CSSPrimitiveValue::CSS_STRING));
+ filterValue->append(cssValuePool().createValue(toReferenceFilterOperation(filterOperation)->url(), CSSPrimitiveValue::CSS_STRING));
break;
- }
- case FilterOperation::GRAYSCALE: {
- BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
+ case FilterOperation::GRAYSCALE:
filterValue = CSSFilterValue::create(CSSFilterValue::GrayscaleFilterOperation);
- filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicColorMatrixFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::SEPIA: {
- BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
+ case FilterOperation::SEPIA:
filterValue = CSSFilterValue::create(CSSFilterValue::SepiaFilterOperation);
- filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicColorMatrixFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::SATURATE: {
- BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
+ case FilterOperation::SATURATE:
filterValue = CSSFilterValue::create(CSSFilterValue::SaturateFilterOperation);
- filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicColorMatrixFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::HUE_ROTATE: {
- BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
+ case FilterOperation::HUE_ROTATE:
filterValue = CSSFilterValue::create(CSSFilterValue::HueRotateFilterOperation);
- filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_DEG));
+ filterValue->append(cssValuePool().createValue(toBasicColorMatrixFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_DEG));
break;
- }
- case FilterOperation::INVERT: {
- BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
+ case FilterOperation::INVERT:
filterValue = CSSFilterValue::create(CSSFilterValue::InvertFilterOperation);
- filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicComponentTransferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::OPACITY: {
- BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
+ case FilterOperation::OPACITY:
filterValue = CSSFilterValue::create(CSSFilterValue::OpacityFilterOperation);
- filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicComponentTransferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::BRIGHTNESS: {
- BasicComponentTransferFilterOperation* brightnessOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
+ case FilterOperation::BRIGHTNESS:
filterValue = CSSFilterValue::create(CSSFilterValue::BrightnessFilterOperation);
- filterValue->append(cssValuePool().createValue(brightnessOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicComponentTransferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::CONTRAST: {
- BasicComponentTransferFilterOperation* contrastOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
+ case FilterOperation::CONTRAST:
filterValue = CSSFilterValue::create(CSSFilterValue::ContrastFilterOperation);
- filterValue->append(cssValuePool().createValue(contrastOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
+ filterValue->append(cssValuePool().createValue(toBasicComponentTransferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
break;
- }
- case FilterOperation::BLUR: {
- BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
+ case FilterOperation::BLUR:
filterValue = CSSFilterValue::create(CSSFilterValue::BlurFilterOperation);
- filterValue->append(zoomAdjustedPixelValue(blurOperation->stdDeviation().value(), style));
+ filterValue->append(zoomAdjustedPixelValue(toBlurFilterOperation(filterOperation)->stdDeviation().value(), style));
break;
- }
case FilterOperation::DROP_SHADOW: {
- DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
+ DropShadowFilterOperation* dropShadowOperation = toDropShadowFilterOperation(filterOperation);
filterValue = CSSFilterValue::create(CSSFilterValue::DropShadowFilterOperation);
// We want our computed style to look like that of a text shadow (has neither spread nor inset style).
ShadowData shadow(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, dropShadowOperation->color());
filterValue->append(valueForShadowData(shadow, style, false));
break;
}
- case FilterOperation::VALIDATED_CUSTOM:
- // ValidatedCustomFilterOperation is not supposed to end up in the RenderStyle.
- ASSERT_NOT_REACHED();
- break;
- case FilterOperation::CUSTOM: {
- CustomFilterOperation* customOperation = static_cast<CustomFilterOperation*>(filterOperation);
- filterValue = CSSFilterValue::create(CSSFilterValue::CustomFilterOperation);
-
- // The output should be verbose, even if the values are the default ones.
-
- ASSERT(customOperation->program());
- StyleCustomFilterProgram* program = static_cast<StyleCustomFilterProgram*>(customOperation->program());
-
- RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated();
- if (program->vertexShader())
- shadersList->append(program->vertexShader()->cssValue());
- else
- shadersList->append(cssValuePool().createIdentifierValue(CSSValueNone));
-
- const CustomFilterProgramMixSettings mixSettings = program->mixSettings();
- if (program->fragmentShader()) {
- if (program->programType() == ProgramTypeBlendsElementTexture) {
- RefPtr<CSSMixFunctionValue> mixFunction = CSSMixFunctionValue::create();
- mixFunction->append(program->fragmentShader()->cssValue());
- mixFunction->append(cssValuePool().createValue(mixSettings.blendMode));
- mixFunction->append(cssValuePool().createValue(mixSettings.compositeOperator));
- shadersList->append(mixFunction.release());
- } else
- shadersList->append(program->fragmentShader()->cssValue());
- }
- else
- shadersList->append(cssValuePool().createIdentifierValue(CSSValueNone));
-
- filterValue->append(shadersList.release());
-
- RefPtr<CSSValueList> meshParameters = CSSValueList::createSpaceSeparated();
- meshParameters->append(cssValuePool().createValue(customOperation->meshColumns(), CSSPrimitiveValue::CSS_NUMBER));
- meshParameters->append(cssValuePool().createValue(customOperation->meshRows(), CSSPrimitiveValue::CSS_NUMBER));
-
- // FIXME: The specification doesn't have any "attached" identifier. Should we add one?
- // https://bugs.webkit.org/show_bug.cgi?id=72700
- if (customOperation->meshType() == MeshTypeDetached)
- meshParameters->append(cssValuePool().createIdentifierValue(CSSValueDetached));
-
- filterValue->append(meshParameters.release());
-
- const CustomFilterParameterList& parameters = customOperation->parameters();
- size_t parametersSize = parameters.size();
- if (!parametersSize)
- break;
- RefPtr<CSSValueList> parametersCSSValue = CSSValueList::createCommaSeparated();
- for (size_t i = 0; i < parametersSize; ++i) {
- const CustomFilterParameter* parameter = parameters.at(i).get();
- RefPtr<CSSValueList> parameterCSSNameAndValue = CSSValueList::createSpaceSeparated();
- parameterCSSNameAndValue->append(cssValuePool().createValue(parameter->name(), CSSPrimitiveValue::CSS_STRING));
- parameterCSSNameAndValue->append(valueForCustomFilterParameter(renderer, style, parameter));
- parametersCSSValue->append(parameterCSSNameAndValue.release());
- }
-
- filterValue->append(parametersCSSValue.release());
- break;
- }
default:
filterValue = CSSFilterValue::create(CSSFilterValue::UnknownFilterOperation);
break;
return list.release();
}
-static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
+static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle& style)
{
if (!trackBreadth.isLength())
return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
const Length& trackBreadthLength = trackBreadth.length();
if (trackBreadthLength.isAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);
- if (trackBreadthLength.isViewportPercentage())
- return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
}
-static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
+static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle& style)
{
switch (trackSize.type()) {
case LengthTrackSizing:
- return valueForGridTrackBreadth(trackSize.length(), style, renderView);
+ return specifiedValueForGridTrackBreadth(trackSize.length(), style);
case MinMaxTrackSizing:
- RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
- minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
- minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
+ RefPtrWillBeRawPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
+ minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
+ minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style));
return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
}
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& orderedNamedGridLines, size_t i, CSSValueList& list)
{
const Vector<String>& namedGridLines = orderedNamedGridLines.get(i);
+ if (namedGridLines.isEmpty())
+ return;
+
+ RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
for (size_t j = 0; j < namedGridLines.size(); ++j)
- list.append(cssValuePool().createValue(namedGridLines[j], CSSPrimitiveValue::CSS_STRING));
+ lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimitiveValue::CSS_STRING));
+ list.append(lineNames.release());
}
-static PassRefPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style, RenderView* renderView)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle& style)
{
- const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style->gridDefinitionColumns() : style->gridDefinitionRows();
- const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style->orderedNamedGridColumnLines() : style->orderedNamedGridRowLines();
+ const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gridTemplateColumns() : style.gridTemplateRows();
+ const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
+ bool isRenderGrid = renderer && renderer->isRenderGrid();
+
+ // 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 = !toRenderBlock(renderer)->firstChild();
+ }
- // Handle the 'none' case here.
- if (!trackSizes.size()) {
+ if (trackListIsEmpty) {
ASSERT(orderedNamedGridLines.isEmpty());
return cssValuePool().createIdentifierValue(CSSValueNone);
}
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (renderer && renderer->isRenderGrid()) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (isRenderGrid) {
const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toRenderGrid(renderer)->columnPositions() : toRenderGrid(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());
- for (size_t i = 0; i < trackSizes.size(); ++i) {
+ for (size_t i = 0; i < trackPositions.size() - 1; ++i) {
addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositions[i], style));
}
} else {
for (size_t i = 0; i < trackSizes.size(); ++i) {
addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
- list->append(specifiedValueForGridTrackSize(trackSizes[i], style, renderView));
+ list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
}
}
// Those are the trailing <string>* allowed in the syntax.
return list.release();
}
-static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition& position)
{
if (position.isAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);
if (position.isNamedGridArea())
return cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (position.isSpan()) {
list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
list->append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
list->append(cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
return list;
}
-static PassRefPtr<CSSValue> createTransitionPropertyValue(const CSSAnimationData* animation)
+
+static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionData::TransitionProperty& property)
{
- RefPtr<CSSValue> propertyValue;
- if (animation->animationMode() == CSSAnimationData::AnimateNone)
- propertyValue = cssValuePool().createIdentifierValue(CSSValueNone);
- else if (animation->animationMode() == CSSAnimationData::AnimateAll)
- propertyValue = cssValuePool().createIdentifierValue(CSSValueAll);
- else
- propertyValue = cssValuePool().createValue(getPropertyNameString(animation->property()), CSSPrimitiveValue::CSS_STRING);
- return propertyValue.release();
+ if (property.propertyType == CSSTransitionData::TransitionNone)
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ if (property.propertyType == CSSTransitionData::TransitionAll)
+ return cssValuePool().createIdentifierValue(CSSValueAll);
+ if (property.propertyType == CSSTransitionData::TransitionUnknown)
+ return cssValuePool().createValue(property.propertyString, CSSPrimitiveValue::CSS_STRING);
+ ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty);
+ return cssValuePool().createValue(getPropertyNameString(property.propertyId), CSSPrimitiveValue::CSS_STRING);
}
-static PassRefPtr<CSSValue> valueForTransitionProperty(const CSSAnimationDataList* animList)
+
+static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTransitionData* transitionData)
{
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- if (animList) {
- for (size_t i = 0; i < animList->size(); ++i)
- list->append(createTransitionPropertyValue(animList->animation(i)));
- } else
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ if (transitionData) {
+ for (size_t i = 0; i < transitionData->propertyList().size(); ++i)
+ list->append(createTransitionPropertyValue(transitionData->propertyList()[i]));
+ } else {
list->append(cssValuePool().createIdentifierValue(CSSValueAll));
+ }
return list.release();
}
-static PassRefPtr<CSSValue> valueForAnimationDelay(const CSSAnimationDataList* animList)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingData* timingData)
{
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- if (animList) {
- for (size_t i = 0; i < animList->size(); ++i)
- list->append(cssValuePool().createValue(animList->animation(i)->delay(), CSSPrimitiveValue::CSS_S));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ if (timingData) {
+ for (size_t i = 0; i < timingData->delayList().size(); ++i)
+ list->append(cssValuePool().createValue(timingData->delayList()[i], CSSPrimitiveValue::CSS_S));
} else {
- // Note that initialAnimationDelay() is used for both transitions and animations
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
+ list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), CSSPrimitiveValue::CSS_S));
}
return list.release();
}
-static PassRefPtr<CSSValue> valueForAnimationDuration(const CSSAnimationDataList* animList)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimingData* timingData)
{
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- if (animList) {
- for (size_t i = 0; i < animList->size(); ++i)
- list->append(cssValuePool().createValue(animList->animation(i)->duration(), CSSPrimitiveValue::CSS_S));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ if (timingData) {
+ for (size_t i = 0; i < timingData->durationList().size(); ++i)
+ list->append(cssValuePool().createValue(timingData->durationList()[i], CSSPrimitiveValue::CSS_S));
} else {
- // Note that initialAnimationDuration() is used for both transitions and animations
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
+ list->append(cssValuePool().createValue(CSSTimingData::initialDuration(), CSSPrimitiveValue::CSS_S));
}
return list.release();
}
-static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double iterationCount)
+{
+ if (iterationCount == std::numeric_limits<double>::infinity())
+ return cssValuePool().createIdentifierValue(CSSValueInfinite);
+ return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayState playState)
+{
+ if (playState == AnimPlayStatePlaying)
+ return cssValuePool().createIdentifierValue(CSSValueRunning);
+ ASSERT(playState == AnimPlayStatePaused);
+ return cssValuePool().createIdentifierValue(CSSValuePaused);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
{
switch (timingFunction->type()) {
case TimingFunction::CubicBezierFunction:
{
- const CubicBezierTimingFunction* bezierTimingFunction = static_cast<const CubicBezierTimingFunction*>(timingFunction);
+ const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezierTimingFunction(timingFunction);
if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Custom) {
CSSValueID valueId = CSSValueInvalid;
switch (bezierTimingFunction->subType()) {
break;
default:
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
return cssValuePool().createIdentifierValue(valueId);
}
case TimingFunction::StepsFunction:
{
- const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
- if (stepsTimingFunction->subType() == StepsTimingFunction::Custom)
- return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
- CSSValueID valueId;
- switch (stepsTimingFunction->subType()) {
- case StepsTimingFunction::Start:
- valueId = CSSValueStepStart;
- break;
- case StepsTimingFunction::End:
- valueId = CSSValueStepEnd;
- break;
- default:
- ASSERT_NOT_REACHED();
- return 0;
- }
+ const StepsTimingFunction* stepsTimingFunction = toStepsTimingFunction(timingFunction);
+ StepsTimingFunction::StepAtPosition position = stepsTimingFunction->stepAtPosition();
+ int steps = stepsTimingFunction->numberOfSteps();
+ ASSERT(position == StepsTimingFunction::Start || position == StepsTimingFunction::End);
+
+ if (steps > 1)
+ return CSSStepsTimingFunctionValue::create(steps, position);
+ CSSValueID valueId = position == StepsTimingFunction::Start ? CSSValueStepStart : CSSValueStepEnd;
return cssValuePool().createIdentifierValue(valueId);
}
}
}
-static PassRefPtr<CSSValue> valueForAnimationTimingFunction(const CSSAnimationDataList* animList)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CSSTimingData* timingData)
{
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- if (animList) {
- for (size_t i = 0; i < animList->size(); ++i)
- list->append(createTimingFunctionValue(animList->animation(i)->timingFunction()));
- } else
- // Note that initialAnimationTimingFunction() is used for both transitions and animations
- list->append(createTimingFunctionValue(CSSAnimationData::initialAnimationTimingFunction().get()));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ if (timingData) {
+ for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i)
+ list->append(createTimingFunctionValue(timingData->timingFunctionList()[i].get()));
+ } else {
+ list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunction().get()));
+ }
return list.release();
}
-static PassRefPtr<CSSValue> valueForAnimationFillMode(unsigned fillMode)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMode fillMode)
{
switch (fillMode) {
- case AnimationFillModeNone:
+ case Timing::FillModeNone:
return cssValuePool().createIdentifierValue(CSSValueNone);
- case AnimationFillModeForwards:
+ case Timing::FillModeForwards:
return cssValuePool().createIdentifierValue(CSSValueForwards);
- case AnimationFillModeBackwards:
+ case Timing::FillModeBackwards:
return cssValuePool().createIdentifierValue(CSSValueBackwards);
- case AnimationFillModeBoth:
+ case Timing::FillModeBoth:
return cssValuePool().createIdentifierValue(CSSValueBoth);
default:
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
}
-static PassRefPtr<CSSValue> valueForAnimationDirection(CSSAnimationData::AnimationDirection direction)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::PlaybackDirection direction)
{
switch (direction) {
- case CSSAnimationData::AnimationDirectionNormal:
+ case Timing::PlaybackDirectionNormal:
return cssValuePool().createIdentifierValue(CSSValueNormal);
- case CSSAnimationData::AnimationDirectionAlternate:
+ case Timing::PlaybackDirectionAlternate:
return cssValuePool().createIdentifierValue(CSSValueAlternate);
- case CSSAnimationData::AnimationDirectionReverse:
+ case Timing::PlaybackDirectionReverse:
return cssValuePool().createIdentifierValue(CSSValueReverse);
- case CSSAnimationData::AnimationDirectionAlternateReverse:
+ case Timing::PlaybackDirectionAlternateReverse:
return cssValuePool().createIdentifierValue(CSSValueAlternateReverse);
default:
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
}
-static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosition)
+{
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ if (willChangeContents)
+ list->append(cssValuePool().createIdentifierValue(CSSValueContents));
+ if (willChangeScrollPosition)
+ list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition));
+ for (size_t i = 0; i < willChangeProperties.size(); ++i)
+ list->append(cssValuePool().createIdentifierValue(willChangeProperties[i]));
+ if (!list->length())
+ list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
+ return list.release();
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
{
if (!lineBoxContain)
return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSLineBoxContainValue::create(lineBoxContain);
}
-CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
+CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtrWillBeRawPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
: m_node(n)
, m_allowVisitedStyle(allowVisitedStyle)
+#if !ENABLE(OILPAN)
, m_refCount(1)
+#endif
{
unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
- AtomicString(pseudoElementName.substring(nameWithoutColonsStart))));
+ AtomicString(pseudoElementName.substring(nameWithoutColonsStart)), false));
}
CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
{
}
+#if !ENABLE(OILPAN)
void CSSComputedStyleDeclaration::ref()
{
++m_refCount;
if (!--m_refCount)
delete this;
}
+#endif
String CSSComputedStyleDeclaration::cssText() const
{
if (i)
result.append(' ');
result.append(getPropertyName(properties[i]));
- result.append(": ", 2);
+ result.appendLiteral(": ");
result.append(getPropertyValue(properties[i]));
result.append(';');
}
return result.toString();
}
-void CSSComputedStyleDeclaration::setCSSText(const String&, ExceptionState& es)
+void CSSComputedStyleDeclaration::setCSSText(const String&, ExceptionState& exceptionState)
{
- es.throwDOMException(NoModificationAllowedError, "Failed to set the 'cssText' property on a computed 'CSSStyleDeclaration': computed styles are read-only.");
+ exceptionState.throwDOMException(NoModificationAllowedError, "These styles are computed, and therefore read-only.");
}
static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() const
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() const
{
if (!m_node)
- return 0;
+ return nullptr;
m_node->document().updateLayoutIgnorePendingStylesheets();
RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
if (!style)
- return 0;
+ return nullptr;
if (int keywordSize = style->fontDescription().keywordSize())
return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
- return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
+ return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), *style);
}
-bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
+FixedPitchFontType CSSComputedStyleDeclaration::fixedPitchFontType() const
{
if (!m_node)
- return false;
+ return NonFixedPitchFont;
RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
if (!style)
- return false;
+ return NonFixedPitchFont;
- return style->fontDescription().useFixedDefaultSize();
+ return style->fontDescription().fixedPitchFontType();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowData(const ShadowData& shadow, const RenderStyle* style, bool useSpread) const
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowData(const ShadowData& shadow, const RenderStyle& style, bool useSpread) const
{
- RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
- RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
- RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style);
- RefPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow.spread(), style) : PassRefPtr<CSSPrimitiveValue>();
- RefPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
- RefPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.color());
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueInset);
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.color());
return CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), shadowStyle.release(), color.release());
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowList(const ShadowList* shadowList, const RenderStyle* style, bool useSpread) const
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowList(const ShadowList* shadowList, const RenderStyle& style, bool useSpread) const
{
if (!shadowList)
return cssValuePool().createIdentifierValue(CSSValueNone);
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
size_t shadowCount = shadowList->shadows().size();
for (size_t i = 0; i < shadowCount; ++i)
list->append(valueForShadowData(shadowList->shadows()[i], style, useSpread));
return list.release();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID) const
-{
- return getPropertyCSSValue(propertyID, UpdateLayout);
-}
-
static CSSValueID identifierForFamily(const AtomicString& family)
{
if (family == FontFamilyNames::webkit_cursive)
return CSSValueInvalid;
}
-static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
{
if (CSSValueID familyIdentifier = identifierForFamily(family))
return cssValuePool().createIdentifierValue(familyIdentifier);
return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
}
-static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
+static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
{
// Blink value is ignored.
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (textDecoration & TextDecorationUnderline)
list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
if (textDecoration & TextDecorationOverline)
return list.release();
}
-static PassRefPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
{
switch (textDecorationStyle) {
case TextDecorationStyleSolid:
return cssValuePool().createExplicitInitialValue();
}
-static PassRefPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
{
// For backwards compatibility, if both values are equal, just return one of them. And
// if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
return cssValuePool().createIdentifierValue(CSSValueRepeatY);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(cssValuePool().createValue(xRepeat));
list->append(cssValuePool().createValue(yRepeat));
return list.release();
}
-static PassRefPtr<CSSValue> valueForFillSourceType(EMaskSourceType type)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType type)
{
switch (type) {
case MaskAlpha:
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
-static PassRefPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const RenderStyle& style)
{
if (fillSize.type == Contain)
return cssValuePool().createIdentifierValue(CSSValueContain);
if (fillSize.size.height().isAuto())
return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style));
return list.release();
}
-static PassRefPtr<CSSValue> valueForContentData(const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const RenderStyle& style)
{
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ for (const ContentData* contentData = style.contentData(); contentData; contentData = contentData->next()) {
if (contentData->isCounter()) {
- const CounterContent* counter = static_cast<const CounterContentData*>(contentData)->counter();
+ const CounterContent* counter = toCounterContentData(contentData)->counter();
ASSERT(counter);
list->append(cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
} else if (contentData->isImage()) {
- const StyleImage* image = static_cast<const ImageContentData*>(contentData)->image();
+ const StyleImage* image = toImageContentData(contentData)->image();
ASSERT(image);
list->append(image->cssValue());
- } else if (contentData->isText())
- list->append(cssValuePool().createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
+ } else if (contentData->isText()) {
+ list->append(cssValuePool().createValue(toTextContentData(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
+ }
}
- if (style->hasFlowFrom())
- list->append(cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
return list.release();
}
-static PassRefPtr<CSSValue> valueForCounterDirectives(const RenderStyle* style, CSSPropertyID propertyID)
+static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const RenderStyle& style, CSSPropertyID propertyID)
{
- const CounterDirectiveMap* map = style->counterDirectives();
+ const CounterDirectiveMap* map = style.counterDirectives();
if (!map)
- return 0;
+ return nullptr;
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
short number = propertyID == CSSPropertyCounterIncrement ? it->value.incrementValue() : it->value.resetValue();
if (!propertyIDSet.add(propertyID).isNewEntry)
return;
- LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
+ WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
}
-static PassRefPtr<CSSValueList> valueForFontFamily(RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(RenderStyle& style)
{
- const FontFamily& firstFamily = style->fontDescription().family();
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FontFamily& firstFamily = style.fontDescription().family();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (const FontFamily* family = &firstFamily; family; family = family->next())
list->append(valueForFamily(family->family()));
return list.release();
}
-static PassRefPtr<CSSPrimitiveValue> valueForLineHeight(RenderStyle* style, RenderView* renderView)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(RenderStyle& style)
{
- Length length = style->lineHeight();
+ Length length = style.lineHeight();
if (length.isNegative())
return cssValuePool().createIdentifierValue(CSSValueNormal);
- return zoomAdjustedPixelValue(floatValueForLength(length, style->fontDescription().specifiedSize(), renderView), style);
+ return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescription().specifiedSize()), style);
}
-static PassRefPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& style)
{
- return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style);
+ return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), style);
}
-static PassRefPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle& style)
{
- if (style->fontDescription().italic())
- return cssValuePool().createIdentifierValue(CSSValueItalic);
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createValue(style.fontDescription().stretch());
}
-static PassRefPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style)
{
- if (style->fontDescription().smallCaps())
- return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createValue(style.fontDescription().style());
}
-static PassRefPtr<CSSPrimitiveValue> valueForFontWeight(RenderStyle* style)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle& style)
{
- switch (style->fontDescription().weight()) {
- case FontWeight100:
- return cssValuePool().createIdentifierValue(CSSValue100);
- case FontWeight200:
- return cssValuePool().createIdentifierValue(CSSValue200);
- case FontWeight300:
- return cssValuePool().createIdentifierValue(CSSValue300);
- case FontWeightNormal:
- return cssValuePool().createIdentifierValue(CSSValueNormal);
- case FontWeight500:
- return cssValuePool().createIdentifierValue(CSSValue500);
- case FontWeight600:
- return cssValuePool().createIdentifierValue(CSSValue600);
- case FontWeightBold:
- return cssValuePool().createIdentifierValue(CSSValueBold);
- case FontWeight800:
- return cssValuePool().createIdentifierValue(CSSValue800);
- case FontWeight900:
- return cssValuePool().createIdentifierValue(CSSValue900);
+ return cssValuePool().createValue(style.fontDescription().variant());
+}
+
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(RenderStyle& style)
+{
+ return cssValuePool().createValue(style.fontDescription().weight());
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const RenderStyle& style, ShapeValue* shapeValue)
+{
+ if (!shapeValue)
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ if (shapeValue->type() == ShapeValue::Box)
+ return cssValuePool().createValue(shapeValue->cssBox());
+ if (shapeValue->type() == ShapeValue::Image) {
+ if (shapeValue->image())
+ return shapeValue->image()->cssValue();
+ return cssValuePool().createIdentifierValue(CSSValueNone);
}
- ASSERT_NOT_REACHED();
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+
+ ASSERT(shapeValue->type() == ShapeValue::Shape);
+
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(valueForBasicShape(style, shapeValue->shape()));
+ if (shapeValue->cssBox() != BoxMissing)
+ list->append(cssValuePool().createValue(shapeValue->cssBox()));
+ return list.release();
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
+{
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (touchAction == TouchActionAuto)
+ list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
+ if (touchAction & TouchActionNone) {
+ ASSERT(touchAction == TouchActionNone);
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ }
+ if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom)) {
+ list->append(cssValuePool().createIdentifierValue(CSSValueManipulation));
+ } else {
+ if (touchAction & TouchActionPanX)
+ list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
+ if (touchAction & TouchActionPanY)
+ list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
+ }
+ ASSERT(list->length());
+ return list.release();
}
static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer)
// FIXME: Some of these cases could be narrowed down or optimized better.
switch (propertyID) {
case CSSPropertyBottom:
- case CSSPropertyGridDefinitionColumns:
- case CSSPropertyGridDefinitionRows:
+ case CSSPropertyGridTemplateColumns:
+ case CSSPropertyGridTemplateRows:
case CSSPropertyHeight:
case CSSPropertyLeft:
case CSSPropertyRight:
case CSSPropertyTop:
+ case CSSPropertyPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOrigin:
+ case CSSPropertyTransform:
case CSSPropertyWebkitTransform:
+ case CSSPropertyTransformOrigin:
case CSSPropertyWebkitTransformOrigin:
case CSSPropertyWidth:
case CSSPropertyWebkitFilter:
}
}
-PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle(CSSPropertyID propertyID) const
+PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle() const
{
Node* styledNode = this->styledNode();
ASSERT(styledNode);
- RenderObject* renderer = styledNode->renderer();
- if (renderer && renderer->compositingState() == PaintsIntoOwnBacking
- && !RuntimeEnabledFeatures::webAnimationsCSSEnabled() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
- AnimationUpdateBlock animationUpdateBlock(renderer->animation());
- if (m_pseudoElementSpecifier && !styledNode->isPseudoElement()) {
- // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
- return renderer->animation().getAnimatedStyleForRenderer(renderer)->getCachedPseudoStyle(m_pseudoElementSpecifier);
- }
- return renderer->animation().getAnimatedStyleForRenderer(renderer);
- }
return styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : m_pseudoElementSpecifier);
}
return m_node.get();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
+static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
+{
+ if (position != ItemPositionAuto)
+ return position;
+
+ bool isFlexOrGrid = element && element->computedStyle()
+ && element->computedStyle()->isDisplayFlexibleOrGridBox();
+
+ return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
+}
+
+static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
+{
+ RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
+ if (positionType == LegacyPosition)
+ result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
+ result->append(CSSPrimitiveValue::create(itemPosition));
+ if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault)
+ result->append(CSSPrimitiveValue::create(overflowAlignment));
+ ASSERT(result->length() <= 2);
+ return result.release();
+}
+
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
{
Node* styledNode = this->styledNode();
if (!styledNode)
- return 0;
+ return nullptr;
RenderObject* renderer = styledNode->renderer();
RefPtr<RenderStyle> style;
if (updateLayout) {
Document& document = styledNode->document();
- document.updateStyleForNodeIfNeeded(styledNode);
+ // A timing update may be required if a compositor animation is running.
+ DocumentAnimations::updateAnimationTimingForGetComputedStyle(*styledNode, propertyID);
+
+ document.updateRenderTreeForNodeIfNeeded(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();
renderer = styledNode->renderer();
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
bool forceFullLayout = isLayoutDependent(propertyID, style, renderer)
|| styledNode->isInShadowTree()
- || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement())
- || document.seamlessParentIFrame();
+ || (document.ownerElement() && document.ensureStyleResolver().hasViewportDependentMediaQueries());
if (forceFullLayout) {
document.updateLayoutIgnorePendingStylesheets();
styledNode = this->styledNode();
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
renderer = styledNode->renderer();
}
} else {
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
}
if (!style)
- return 0;
+ return nullptr;
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
switch (propertyID) {
case CSSPropertyInvalid:
- case CSSPropertyVariable:
break;
case CSSPropertyBackgroundColor:
- return cssValuePool().createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(*style, style->backgroundColor());
case CSSPropertyBackgroundImage:
case CSSPropertyWebkitMaskImage: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
- if (!layers)
- return cssValuePool().createIdentifierValue(CSSValueNone);
-
- if (!layers->next()) {
- if (layers->image())
- return layers->image()->cssValue();
-
- return cssValuePool().createIdentifierValue(CSSValueNone);
- }
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next()) {
if (currLayer->image())
list->append(currLayer->image()->cssValue());
else
case CSSPropertyBackgroundSize:
case CSSPropertyWebkitBackgroundSize:
case CSSPropertyWebkitMaskSize: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- return valueForFillSize(layers->size(), style.get());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(valueForFillSize(currLayer->size(), style.get()));
-
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
+ list->append(valueForFillSize(currLayer->size(), *style));
return list.release();
}
case CSSPropertyBackgroundRepeat:
case CSSPropertyWebkitMaskRepeat: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- return valueForFillRepeat(layers->repeatX(), layers->repeatY());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->repeatY()));
-
return list.release();
}
case CSSPropertyMaskSourceType: {
- const FillLayer* layers = style->maskLayers();
-
- if (!layers)
- return cssValuePool().createIdentifierValue(CSSValueNone);
-
- if (!layers->next())
- return valueForFillSourceType(layers->maskSourceType());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = &style->maskLayers(); currLayer; currLayer = currLayer->next())
list->append(valueForFillSourceType(currLayer->maskSourceType()));
-
return list.release();
}
case CSSPropertyWebkitBackgroundComposite:
case CSSPropertyWebkitMaskComposite: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- return cssValuePool().createValue(layers->composite());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposite ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
list->append(cssValuePool().createValue(currLayer->composite()));
-
return list.release();
}
case CSSPropertyBackgroundAttachment: {
- const FillLayer* layers = style->backgroundLayers();
- if (!layers->next())
- return cssValuePool().createValue(layers->attachment());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = &style->backgroundLayers(); currLayer; currLayer = currLayer->next())
list->append(cssValuePool().createValue(currLayer->attachment()));
-
return list.release();
}
case CSSPropertyBackgroundClip:
case CSSPropertyWebkitBackgroundOrigin:
case CSSPropertyWebkitMaskClip:
case CSSPropertyWebkitMaskOrigin: {
- const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
- if (!layers->next()) {
- EFillBox box = isClip ? layers->clip() : layers->origin();
- return cssValuePool().createValue(box);
- }
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next()) {
EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
list->append(cssValuePool().createValue(box));
}
-
return list.release();
}
case CSSPropertyBackgroundPosition:
case CSSPropertyWebkitMaskPosition: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- 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.get()));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
+ list->append(createPositionListForLayer(propertyID, *currLayer, *style));
return list.release();
}
case CSSPropertyBackgroundPositionX:
case CSSPropertyWebkitMaskPositionX: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- 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()));
-
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPositionX ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
+ list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), *style));
return list.release();
}
case CSSPropertyBackgroundPositionY:
case CSSPropertyWebkitMaskPositionY: {
- const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
- if (!layers->next())
- 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()));
-
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPositionY ? &style->maskLayers() : &style->backgroundLayers();
+ for (; currLayer; currLayer = currLayer->next())
+ list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(), *style));
return list.release();
}
case CSSPropertyBorderCollapse:
return cssValuePool().createIdentifierValue(CSSValueCollapse);
return cssValuePool().createIdentifierValue(CSSValueSeparate);
case CSSPropertyBorderSpacing: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
- list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style));
+ list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style));
return list.release();
}
case CSSPropertyWebkitBorderHorizontalSpacing:
- return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
+ return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style);
case CSSPropertyWebkitBorderVerticalSpacing:
- return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
+ return zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style);
case CSSPropertyBorderImageSource:
if (style->borderImageSource())
return style->borderImageSource()->cssValue();
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, 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, 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, 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, style->borderLeftColor());
case CSSPropertyBorderTopStyle:
return cssValuePool().createValue(style->borderTopStyle());
case CSSPropertyBorderRightStyle:
case CSSPropertyBorderLeftStyle:
return cssValuePool().createValue(style->borderLeftStyle());
case CSSPropertyBorderTopWidth:
- return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
+ return zoomAdjustedPixelValue(style->borderTopWidth(), *style);
case CSSPropertyBorderRightWidth:
- return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
+ return zoomAdjustedPixelValue(style->borderRightWidth(), *style);
case CSSPropertyBorderBottomWidth:
- return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
+ return zoomAdjustedPixelValue(style->borderBottomWidth(), *style);
case CSSPropertyBorderLeftWidth:
- return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
+ return zoomAdjustedPixelValue(style->borderLeftWidth(), *style);
case CSSPropertyBottom:
- return valueForPositionOffset(style.get(), CSSPropertyBottom, renderer, m_node->document().renderView());
+ return valueForPositionOffset(*style, CSSPropertyBottom, renderer);
case CSSPropertyWebkitBoxAlign:
return cssValuePool().createValue(style->boxAlign());
case CSSPropertyWebkitBoxDecorationBreak:
case CSSPropertyWebkitBoxPack:
return cssValuePool().createValue(style->boxPack());
case CSSPropertyWebkitBoxReflect:
- return valueForReflection(style->boxReflect(), style.get());
+ return valueForReflection(style->boxReflect(), *style);
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
- return valueForShadowList(style->boxShadow(), style.get(), true);
+ return valueForShadowList(style->boxShadow(), *style, true);
case CSSPropertyCaptionSide:
return cssValuePool().createValue(style->captionSide());
case CSSPropertyClear:
return cssValuePool().createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
case CSSPropertyWebkitPrintColorAdjust:
return cssValuePool().createValue(style->printColorAdjust());
- case CSSPropertyWebkitColumnAxis:
- return cssValuePool().createValue(style->columnAxis());
case CSSPropertyWebkitColumnCount:
if (style->hasAutoColumnCount())
return cssValuePool().createIdentifierValue(CSSValueAuto);
return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyColumnFill:
- if (RuntimeEnabledFeatures::regionBasedColumnsEnabled())
- return cssValuePool().createValue(style->columnFill());
- return 0;
+ ASSERT(RuntimeEnabledFeatures::regionBasedColumnsEnabled());
+ return cssValuePool().createValue(style->columnFill());
case CSSPropertyWebkitColumnGap:
if (style->hasNormalColumnGap())
return cssValuePool().createIdentifierValue(CSSValueNormal);
- return zoomAdjustedPixelValue(style->columnGap(), style.get());
- case CSSPropertyWebkitColumnProgression:
- return cssValuePool().createValue(style->columnProgression());
+ return zoomAdjustedPixelValue(style->columnGap(), *style);
case CSSPropertyWebkitColumnRuleColor:
- return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(*style, style->columnRuleColor());
case CSSPropertyWebkitColumnRuleStyle:
return cssValuePool().createValue(style->columnRuleStyle());
case CSSPropertyWebkitColumnRuleWidth:
- return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
+ return zoomAdjustedPixelValue(style->columnRuleWidth(), *style);
case CSSPropertyWebkitColumnSpan:
return cssValuePool().createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
case CSSPropertyWebkitColumnBreakAfter:
case CSSPropertyWebkitColumnWidth:
if (style->hasAutoColumnWidth())
return cssValuePool().createIdentifierValue(CSSValueAuto);
- return zoomAdjustedPixelValue(style->columnWidth(), style.get());
+ return zoomAdjustedPixelValue(style->columnWidth(), *style);
case CSSPropertyTabSize:
return cssValuePool().createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
- case CSSPropertyWebkitRegionBreakAfter:
- return cssValuePool().createValue(style->regionBreakAfter());
- case CSSPropertyWebkitRegionBreakBefore:
- return cssValuePool().createValue(style->regionBreakBefore());
- case CSSPropertyWebkitRegionBreakInside:
- return cssValuePool().createValue(style->regionBreakInside());
case CSSPropertyCursor: {
- RefPtr<CSSValueList> list;
+ RefPtrWillBeRawPtr<CSSValueList> list = nullptr;
CursorList* cursors = style->cursors();
if (cursors && cursors->size() > 0) {
list = CSSValueList::createCommaSeparated();
if (StyleImage* image = cursors->at(i).image())
list->append(image->cssValue());
}
- RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
+ RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
if (list) {
list->append(value.release());
return list.release();
case CSSPropertyAlignContent:
return cssValuePool().createValue(style->alignContent());
case CSSPropertyAlignItems:
- return cssValuePool().createValue(style->alignItems());
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLegacyPosition);
case CSSPropertyAlignSelf:
- 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());
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignment(), NonLegacyPosition);
case CSSPropertyFlex:
return valuesForShorthandProperty(flexShorthand());
case CSSPropertyFlexBasis:
- return cssValuePool().createValue(style->flexBasis());
+ return zoomAdjustedPixelValueForLength(style->flexBasis(), *style);
case CSSPropertyFlexDirection:
return cssValuePool().createValue(style->flexDirection());
case CSSPropertyFlexFlow:
return cssValuePool().createIdentifierValue(CSSValueNone);
return cssValuePool().createValue(style->floating());
case CSSPropertyFont: {
- RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
- computedFont->style = valueForFontStyle(style.get());
- computedFont->variant = valueForFontVariant(style.get());
- computedFont->weight = valueForFontWeight(style.get());
- computedFont->size = valueForFontSize(style.get());
- computedFont->lineHeight = valueForLineHeight(style.get(), m_node->document().renderView());
- computedFont->family = valueForFontFamily(style.get());
+ RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create();
+ computedFont->style = valueForFontStyle(*style);
+ computedFont->variant = valueForFontVariant(*style);
+ computedFont->weight = valueForFontWeight(*style);
+ computedFont->stretch = valueForFontStretch(*style);
+ computedFont->size = valueForFontSize(*style);
+ computedFont->lineHeight = valueForLineHeight(*style);
+ computedFont->family = valueForFontFamily(*style);
return computedFont.release();
}
case CSSPropertyFontFamily: {
- RefPtr<CSSValueList> fontFamilyList = valueForFontFamily(style.get());
+ RefPtrWillBeRawPtr<CSSValueList> fontFamilyList = valueForFontFamily(*style);
// If there's only a single family, return that as a CSSPrimitiveValue.
// NOTE: Gecko always returns this as a comma-separated CSSPrimitiveValue string.
if (fontFamilyList->length() == 1)
return fontFamilyList.release();
}
case CSSPropertyFontSize:
- return valueForFontSize(style.get());
+ return valueForFontSize(*style);
+ case CSSPropertyFontStretch:
+ return valueForFontStretch(*style);
case CSSPropertyFontStyle:
- return valueForFontStyle(style.get());
+ return valueForFontStyle(*style);
case CSSPropertyFontVariant:
- return valueForFontVariant(style.get());
+ return valueForFontVariant(*style);
case CSSPropertyFontWeight:
- return valueForFontWeight(style.get());
+ return valueForFontWeight(*style);
case CSSPropertyWebkitFontFeatureSettings: {
const FontFeatureSettings* featureSettings = style->fontDescription().featureSettings();
if (!featureSettings || !featureSettings->size())
return cssValuePool().createIdentifierValue(CSSValueNormal);
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
for (unsigned i = 0; i < featureSettings->size(); ++i) {
const FontFeature& feature = featureSettings->at(i);
- RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::create(feature.tag(), feature.value());
+ RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::create(feature.tag(), feature.value());
list->append(featureValue.release());
}
return list.release();
}
- case CSSPropertyGridAutoFlow:
- return cssValuePool().createValue(style->gridAutoFlow());
+ case CSSPropertyGridAutoFlow: {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ switch (style->gridAutoFlow()) {
+ case AutoFlowRow:
+ case AutoFlowRowDense:
+ list->append(cssValuePool().createIdentifierValue(CSSValueRow));
+ break;
+ case AutoFlowColumn:
+ case AutoFlowColumnDense:
+ list->append(cssValuePool().createIdentifierValue(CSSValueColumn));
+ break;
+ case AutoFlowStackRow:
+ case AutoFlowStackColumn:
+ list->append(cssValuePool().createIdentifierValue(CSSValueStack));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ switch (style->gridAutoFlow()) {
+ case AutoFlowRowDense:
+ case AutoFlowColumnDense:
+ list->append(cssValuePool().createIdentifierValue(CSSValueDense));
+ break;
+ case AutoFlowStackRow:
+ list->append(cssValuePool().createIdentifierValue(CSSValueRow));
+ break;
+ case AutoFlowStackColumn:
+ list->append(cssValuePool().createIdentifierValue(CSSValueColumn));
+ break;
+ default:
+ // Do nothing.
+ break;
+ }
+
+ 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 CSSPropertyGridAutoColumns:
- return specifiedValueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
+ return specifiedValueForGridTrackSize(style->gridAutoColumns(), *style);
case CSSPropertyGridAutoRows:
- return specifiedValueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
+ return specifiedValueForGridTrackSize(style->gridAutoRows(), *style);
- case CSSPropertyGridDefinitionColumns:
- return valueForGridTrackList(ForColumns, renderer, style.get(), m_node->document().renderView());
- case CSSPropertyGridDefinitionRows:
- return valueForGridTrackList(ForRows, renderer, style.get(), m_node->document().renderView());
+ case CSSPropertyGridTemplateColumns:
+ return valueForGridTrackList(ForColumns, renderer, *style);
+ case CSSPropertyGridTemplateRows:
+ return valueForGridTrackList(ForRows, renderer, *style);
case CSSPropertyGridColumnStart:
return valueForGridPosition(style->gridColumnStart());
return valuesForGridShorthand(gridRowShorthand());
case CSSPropertyGridArea:
return valuesForGridShorthand(gridAreaShorthand());
-
case CSSPropertyGridTemplate:
+ return valuesForGridShorthand(gridTemplateShorthand());
+ case CSSPropertyGrid:
+ return valuesForGridShorthand(gridShorthand());
+ case CSSPropertyGridTemplateAreas:
if (!style->namedGridAreaRowCount()) {
ASSERT(!style->namedGridAreaColumnCount());
return cssValuePool().createIdentifierValue(CSSValueNone);
}
- return CSSGridTemplateValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
+ return CSSGridTemplateAreasValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
case CSSPropertyHeight:
if (renderer) {
// 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.get());
+ return zoomAdjustedPixelValue(sizingBox(renderer).height(), *style);
}
- return zoomAdjustedPixelValueForLength(style->height(), style.get());
+ return zoomAdjustedPixelValueForLength(style->height(), *style);
case CSSPropertyWebkitHighlight:
if (style->highlight() == nullAtom)
return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSPrimitiveValue::create(style->imageRendering());
case CSSPropertyIsolation:
return cssValuePool().createValue(style->isolation());
+ case CSSPropertyJustifyItems:
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifyItems(), styledNode), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
+ case CSSPropertyJustifySelf:
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAlignment(), NonLegacyPosition);
case CSSPropertyLeft:
- return valueForPositionOffset(style.get(), CSSPropertyLeft, renderer, m_node->document().renderView());
+ return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
case CSSPropertyLetterSpacing:
if (!style->letterSpacing())
return cssValuePool().createIdentifierValue(CSSValueNormal);
- return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
+ return zoomAdjustedPixelValue(style->letterSpacing(), *style);
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);
case CSSPropertyLineHeight:
- return valueForLineHeight(style.get(), m_node->document().renderView());
+ return valueForLineHeight(*style);
case CSSPropertyListStyleImage:
if (style->listStyleImage())
return style->listStyleImage()->cssValue();
case CSSPropertyMarginTop: {
Length marginTop = style->marginTop();
if (marginTop.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(marginTop, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), style.get());
+ return zoomAdjustedPixelValueForLength(marginTop, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), *style);
}
case CSSPropertyMarginRight: {
Length marginRight = style->marginRight();
if (marginRight.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(marginRight, style.get());
+ return zoomAdjustedPixelValueForLength(marginRight, *style);
float value;
- if (marginRight.isPercent() || marginRight.isViewportPercentage()) {
+ if (marginRight.isPercent()) {
// 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, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
+ value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent()).toFloat();
} else {
- value = toRenderBox(renderer)->marginRight();
+ value = toRenderBox(renderer)->marginRight().toFloat();
}
- return zoomAdjustedPixelValue(value, style.get());
+ return zoomAdjustedPixelValue(value, *style);
}
case CSSPropertyMarginBottom: {
Length marginBottom = style->marginBottom();
if (marginBottom.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(marginBottom, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), style.get());
+ return zoomAdjustedPixelValueForLength(marginBottom, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), *style);
}
case CSSPropertyMarginLeft: {
Length marginLeft = style->marginLeft();
if (marginLeft.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(marginLeft, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), style.get());
+ return zoomAdjustedPixelValueForLength(marginLeft, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), *style);
}
case CSSPropertyWebkitUserModify:
return cssValuePool().createValue(style->userModify());
case CSSPropertyMaxHeight: {
const Length& maxHeight = style->maxHeight();
- if (maxHeight.isUndefined())
+ if (maxHeight.isMaxSizeNone())
return cssValuePool().createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValueForLength(maxHeight, style.get());
+ return zoomAdjustedPixelValueForLength(maxHeight, *style);
}
case CSSPropertyMaxWidth: {
const Length& maxWidth = style->maxWidth();
- if (maxWidth.isUndefined())
+ if (maxWidth.isMaxSizeNone())
return cssValuePool().createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValueForLength(maxWidth, style.get());
+ return zoomAdjustedPixelValueForLength(maxWidth, *style);
}
case CSSPropertyMinHeight:
// 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());
+ return zoomAdjustedPixelValue(0, *style);
+ return zoomAdjustedPixelValueForLength(style->minHeight(), *style);
case CSSPropertyMinWidth:
// 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());
+ return zoomAdjustedPixelValue(0, *style);
+ return zoomAdjustedPixelValueForLength(style->minWidth(), *style);
case CSSPropertyObjectFit:
return cssValuePool().createValue(style->objectFit());
case CSSPropertyObjectPosition:
return cssValuePool().createValue(
Pair::create(
- zoomAdjustedPixelValueForLength(style->objectPosition().x(), style.get()),
- zoomAdjustedPixelValueForLength(style->objectPosition().y(), style.get()),
+ zoomAdjustedPixelValueForLength(style->objectPosition().x(), *style),
+ zoomAdjustedPixelValueForLength(style->objectPosition().y(), *style),
Pair::KeepIdenticalValues));
case CSSPropertyOpacity:
return cssValuePool().createValue(style->opacity(), 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, style->outlineColor());
case CSSPropertyOutlineOffset:
- return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
+ return zoomAdjustedPixelValue(style->outlineOffset(), *style);
case CSSPropertyOutlineStyle:
if (style->outlineStyleIsAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);
return cssValuePool().createValue(style->outlineStyle());
case CSSPropertyOutlineWidth:
- return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
+ return zoomAdjustedPixelValue(style->outlineWidth(), *style);
case CSSPropertyOverflow:
return cssValuePool().createValue(max(style->overflowX(), style->overflowY()));
case CSSPropertyOverflowWrap:
case CSSPropertyPaddingTop: {
Length paddingTop = style->paddingTop();
if (paddingTop.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(paddingTop, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingTop(), style.get());
+ return zoomAdjustedPixelValueForLength(paddingTop, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingTop(), *style);
}
case CSSPropertyPaddingRight: {
Length paddingRight = style->paddingRight();
if (paddingRight.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(paddingRight, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingRight(), style.get());
+ return zoomAdjustedPixelValueForLength(paddingRight, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingRight(), *style);
}
case CSSPropertyPaddingBottom: {
Length paddingBottom = style->paddingBottom();
if (paddingBottom.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(paddingBottom, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingBottom(), style.get());
+ return zoomAdjustedPixelValueForLength(paddingBottom, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingBottom(), *style);
}
case CSSPropertyPaddingLeft: {
Length paddingLeft = style->paddingLeft();
if (paddingLeft.isFixed() || !renderer || !renderer->isBox())
- return zoomAdjustedPixelValueForLength(paddingLeft, style.get());
- return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingLeft(), style.get());
+ return zoomAdjustedPixelValueForLength(paddingLeft, *style);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingLeft(), *style);
}
case CSSPropertyPageBreakAfter:
return cssValuePool().createValue(style->pageBreakAfter());
EPageBreak pageBreak = style->pageBreakInside();
ASSERT(pageBreak != PBALWAYS);
if (pageBreak == PBALWAYS)
- return 0;
+ return nullptr;
return cssValuePool().createValue(style->pageBreakInside());
}
case CSSPropertyPosition:
return cssValuePool().createValue(style->position());
case CSSPropertyRight:
- return valueForPositionOffset(style.get(), CSSPropertyRight, renderer, m_node->document().renderView());
+ return valueForPositionOffset(*style, CSSPropertyRight, renderer);
case CSSPropertyWebkitRubyPosition:
return cssValuePool().createValue(style->rubyPosition());
+ case CSSPropertyScrollBehavior:
+ return cssValuePool().createValue(style->scrollBehavior());
case CSSPropertyTableLayout:
return cssValuePool().createValue(style->tableLayout());
case CSSPropertyTextAlign:
case CSSPropertyTextAlignLast:
return cssValuePool().createValue(style->textAlignLast());
case CSSPropertyTextDecoration:
- return valuesForShorthandProperty(textDecorationShorthand());
+ if (RuntimeEnabledFeatures::css3TextDecorationsEnabled())
+ return valuesForShorthandProperty(textDecorationShorthand());
+ // Fall through.
case CSSPropertyTextDecorationLine:
return renderTextDecorationFlagsToCSSValue(style->textDecoration());
case CSSPropertyTextDecorationStyle:
return valueForTextDecorationStyle(style->textDecorationStyle());
case CSSPropertyTextDecorationColor:
- return currentColorOrValidColor(style.get(), style->textDecorationColor());
+ return currentColorOrValidColor(*style, style->textDecorationColor());
case CSSPropertyTextJustify:
return cssValuePool().createValue(style->textJustify());
case CSSPropertyTextUnderlinePosition:
case CSSPropertyWebkitTextDecorationsInEffect:
return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
case CSSPropertyWebkitTextFillColor:
- return currentColorOrValidColor(style.get(), style->textFillColor());
+ return currentColorOrValidColor(*style, style->textFillColor());
case CSSPropertyWebkitTextEmphasisColor:
- return currentColorOrValidColor(style.get(), style->textEmphasisColor());
+ return currentColorOrValidColor(*style, style->textEmphasisColor());
case CSSPropertyWebkitTextEmphasisPosition:
return cssValuePool().createValue(style->textEmphasisPosition());
case CSSPropertyWebkitTextEmphasisStyle:
case TextEmphasisMarkDoubleCircle:
case TextEmphasisMarkTriangle:
case TextEmphasisMarkSesame: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(cssValuePool().createValue(style->textEmphasisFill()));
list->append(cssValuePool().createValue(style->textEmphasisMark()));
return list.release();
}
}
case CSSPropertyTextIndent: {
- RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), style.get());
- if (RuntimeEnabledFeatures::css3TextEnabled() && style->textIndentLine() == TextIndentEachLine) {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ // If RuntimeEnabledFeatures::css3TextEnabled() returns false or text-indent has only one value(<length> | <percentage>),
+ // getPropertyCSSValue() returns CSSValue.
+ // If RuntimeEnabledFeatures::css3TextEnabled() returns true and text-indent has each-line or hanging,
+ // getPropertyCSSValue() returns CSSValueList.
+ RefPtrWillBeRawPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), *style);
+ if (RuntimeEnabledFeatures::css3TextEnabled() && (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging)) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(textIndent.release());
- list->append(cssValuePool().createIdentifierValue(CSSValueEachLine));
+ if (style->textIndentLine() == TextIndentEachLine)
+ list->append(cssValuePool().createIdentifierValue(CSSValueEachLine));
+ if (style->textIndentType() == TextIndentHanging)
+ list->append(cssValuePool().createIdentifierValue(CSSValueHanging));
return list.release();
}
return textIndent.release();
}
case CSSPropertyTextShadow:
- return valueForShadowList(style->textShadow(), style.get(), false);
+ return valueForShadowList(style->textShadow(), *style, false);
case CSSPropertyTextRendering:
- return cssValuePool().createValue(style->fontDescription().textRenderingMode());
+ return cssValuePool().createValue(style->fontDescription().textRendering());
case CSSPropertyTextOverflow:
if (style->textOverflow())
return cssValuePool().createIdentifierValue(CSSValueEllipsis);
case CSSPropertyWebkitTextSecurity:
return cssValuePool().createValue(style->textSecurity());
case CSSPropertyWebkitTextStrokeColor:
- return currentColorOrValidColor(style.get(), style->textStrokeColor());
+ return currentColorOrValidColor(*style, style->textStrokeColor());
case CSSPropertyWebkitTextStrokeWidth:
- return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
+ return zoomAdjustedPixelValue(style->textStrokeWidth(), *style);
case CSSPropertyTextTransform:
return cssValuePool().createValue(style->textTransform());
case CSSPropertyTop:
- return valueForPositionOffset(style.get(), CSSPropertyTop, renderer, m_node->document().renderView());
+ return valueForPositionOffset(*style, CSSPropertyTop, renderer);
case CSSPropertyTouchAction:
- return cssValuePool().createValue(style->touchAction());
+ return touchActionFlagsToCSSValue(style->touchAction());
case CSSPropertyTouchActionDelay:
return cssValuePool().createValue(style->touchActionDelay());
case CSSPropertyUnicodeBidi:
case BASELINE_MIDDLE:
return cssValuePool().createIdentifierValue(CSSValueWebkitBaselineMiddle);
case LENGTH:
- return cssValuePool().createValue(style->verticalAlignLength());
+ return zoomAdjustedPixelValueForLength(style->verticalAlignLength(), *style);
}
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
case CSSPropertyVisibility:
return cssValuePool().createValue(style->visibility());
case CSSPropertyWhiteSpace:
// 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.get());
+ return zoomAdjustedPixelValue(sizingBox(renderer).width(), *style);
}
- return zoomAdjustedPixelValueForLength(style->width(), style.get());
+ return zoomAdjustedPixelValueForLength(style->width(), *style);
+ case CSSPropertyWillChange:
+ return valueForWillChange(style->willChangeProperties(), style->willChangeContents(), style->willChangeScrollPosition());
case CSSPropertyWordBreak:
return cssValuePool().createValue(style->wordBreak());
case CSSPropertyWordSpacing:
- return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
+ return zoomAdjustedPixelValue(style->wordSpacing(), *style);
case CSSPropertyWordWrap:
return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyWebkitLineBreak:
return cssValuePool().createValue(style->lineBreak());
case CSSPropertyResize:
return cssValuePool().createValue(style->resize());
- case CSSPropertyWebkitFontKerning:
+ case CSSPropertyFontKerning:
return cssValuePool().createValue(style->fontDescription().kerning());
case CSSPropertyWebkitFontSmoothing:
return cssValuePool().createValue(style->fontDescription().fontSmoothing());
- case CSSPropertyWebkitFontVariantLigatures: {
+ case CSSPropertyFontVariantLigatures: {
FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
+ FontDescription::LigaturesState contextualLigaturesState = style->fontDescription().contextualLigaturesState();
if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
- && historicalLigaturesState == FontDescription::NormalLigaturesState)
+ && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState)
return cssValuePool().createIdentifierValue(CSSValueNormal);
- RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<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));
+ if (contextualLigaturesState != FontDescription::NormalLigaturesState)
+ valueList->append(cssValuePool().createIdentifierValue(contextualLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSValueContextual));
return valueList;
}
case CSSPropertyZIndex:
case CSSPropertyAnimationDirection:
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
case CSSPropertyWebkitAnimationDirection: {
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- const CSSAnimationDataList* t = style->animations();
- if (t) {
- for (size_t i = 0; i < t->size(); ++i)
- list->append(valueForAnimationDirection(t->animation(i)->direction()));
- } else
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ for (size_t i = 0; i < animationData->directionList().size(); ++i)
+ list->append(valueForAnimationDirection(animationData->directionList()[i]));
+ } else {
list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
+ }
return list.release();
}
case CSSPropertyAnimationDuration:
case CSSPropertyAnimationFillMode:
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
case CSSPropertyWebkitAnimationFillMode: {
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- const CSSAnimationDataList* t = style->animations();
- if (t) {
- for (size_t i = 0; i < t->size(); ++i)
- list->append(valueForAnimationFillMode(t->animation(i)->fillMode()));
- } else
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ for (size_t i = 0; i < animationData->fillModeList().size(); ++i)
+ list->append(valueForAnimationFillMode(animationData->fillModeList()[i]));
+ } else {
list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ }
return list.release();
}
case CSSPropertyAnimationIterationCount:
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
case CSSPropertyWebkitAnimationIterationCount: {
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- const CSSAnimationDataList* t = style->animations();
- if (t) {
- for (size_t i = 0; i < t->size(); ++i) {
- double iterationCount = t->animation(i)->iterationCount();
- if (iterationCount == CSSAnimationData::IterationCountInfinite)
- list->append(cssValuePool().createIdentifierValue(CSSValueInfinite));
- else
- list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
- }
- } else
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ for (size_t i = 0; i < animationData->iterationCountList().size(); ++i)
+ list->append(valueForAnimationIterationCount(animationData->iterationCountList()[i]));
+ } else {
+ list->append(cssValuePool().createValue(CSSAnimationData::initialIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
+ }
return list.release();
}
case CSSPropertyAnimationName:
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
case CSSPropertyWebkitAnimationName: {
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- const CSSAnimationDataList* 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));
- } else
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ for (size_t i = 0; i < animationData->nameList().size(); ++i)
+ list->append(cssValuePool().createValue(animationData->nameList()[i], CSSPrimitiveValue::CSS_STRING));
+ } else {
list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ }
return list.release();
}
case CSSPropertyAnimationPlayState:
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
case CSSPropertyWebkitAnimationPlayState: {
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- const CSSAnimationDataList* t = style->animations();
- if (t) {
- for (size_t i = 0; i < t->size(); ++i) {
- int prop = t->animation(i)->playState();
- if (prop == AnimPlayStatePlaying)
- list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
- else
- list->append(cssValuePool().createIdentifierValue(CSSValuePaused));
- }
- } else
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ for (size_t i = 0; i < animationData->playStateList().size(); ++i)
+ list->append(valueForAnimationPlayState(animationData->playStateList()[i]));
+ } else {
list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
+ }
return list.release();
}
case CSSPropertyAnimationTimingFunction:
return valueForAnimationTimingFunction(style->animations());
case CSSPropertyAnimation:
case CSSPropertyWebkitAnimation: {
- const CSSAnimationDataList* animations = style->animations();
- if (animations) {
- RefPtr<CSSValueList> animationsList = CSSValueList::createCommaSeparated();
- for (size_t i = 0; i < animations->size(); ++i) {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- const CSSAnimationData* animation = animations->animation(i);
- list->append(cssValuePool().createValue(animation->name(), CSSPrimitiveValue::CSS_STRING));
- list->append(cssValuePool().createValue(animation->duration(), CSSPrimitiveValue::CSS_S));
- list->append(createTimingFunctionValue(animation->timingFunction()));
- list->append(cssValuePool().createValue(animation->delay(), CSSPrimitiveValue::CSS_S));
- if (animation->iterationCount() == CSSAnimationData::IterationCountInfinite)
- list->append(cssValuePool().createIdentifierValue(CSSValueInfinite));
- else
- list->append(cssValuePool().createValue(animation->iterationCount(), CSSPrimitiveValue::CSS_NUMBER));
- list->append(valueForAnimationDirection(animation->direction()));
- list->append(valueForAnimationFillMode(animation->fillMode()));
- if (animation->playState() == AnimPlayStatePaused)
- list->append(cssValuePool().createIdentifierValue(CSSValuePaused));
- else
- list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
+ const CSSAnimationData* animationData = style->animations();
+ if (animationData) {
+ RefPtrWillBeRawPtr<CSSValueList> animationsList = CSSValueList::createCommaSeparated();
+ for (size_t i = 0; i < animationData->nameList().size(); ++i) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(cssValuePool().createValue(animationData->nameList()[i], CSSPrimitiveValue::CSS_STRING));
+ list->append(cssValuePool().createValue(CSSTimingData::getRepeated(animationData->durationList(), i), CSSPrimitiveValue::CSS_S));
+ list->append(createTimingFunctionValue(CSSTimingData::getRepeated(animationData->timingFunctionList(), i).get()));
+ list->append(cssValuePool().createValue(CSSTimingData::getRepeated(animationData->delayList(), i), CSSPrimitiveValue::CSS_S));
+ list->append(valueForAnimationIterationCount(CSSTimingData::getRepeated(animationData->iterationCountList(), i)));
+ list->append(valueForAnimationDirection(CSSTimingData::getRepeated(animationData->directionList(), i)));
+ list->append(valueForAnimationFillMode(CSSTimingData::getRepeated(animationData->fillModeList(), i)));
+ list->append(valueForAnimationPlayState(CSSTimingData::getRepeated(animationData->playStateList(), i)));
animationsList->append(list);
}
return animationsList.release();
}
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// animation-name default value.
list->append(cssValuePool().createIdentifierValue(CSSValueNone));
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
- list->append(createTimingFunctionValue(CSSAnimationData::initialAnimationTimingFunction().get()));
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
- list->append(valueForAnimationDirection(CSSAnimationData::initialAnimationDirection()));
- list->append(valueForAnimationFillMode(CSSAnimationData::initialAnimationFillMode()));
+ list->append(cssValuePool().createValue(CSSAnimationData::initialDuration(), CSSPrimitiveValue::CSS_S));
+ list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFunction().get()));
+ list->append(cssValuePool().createValue(CSSAnimationData::initialDelay(), CSSPrimitiveValue::CSS_S));
+ list->append(cssValuePool().createValue(CSSAnimationData::initialIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
+ list->append(valueForAnimationDirection(CSSAnimationData::initialDirection()));
+ list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode()));
// Initial animation-play-state.
list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
return list.release();
if (!style->hasAspectRatio())
return cssValuePool().createIdentifierValue(CSSValueNone);
return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
+ case CSSPropertyBackfaceVisibility:
case CSSPropertyWebkitBackfaceVisibility:
return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
case CSSPropertyWebkitBorderImage:
- return valueForNinePieceImage(style->borderImage(), style.get());
+ return valueForNinePieceImage(style->borderImage(), *style);
case CSSPropertyBorderImageOutset:
- return valueForNinePieceImageQuad(style->borderImage().outset(), style.get());
+ return valueForNinePieceImageQuad(style->borderImage().outset(), *style);
case CSSPropertyBorderImageRepeat:
return valueForNinePieceImageRepeat(style->borderImage());
case CSSPropertyBorderImageSlice:
return valueForNinePieceImageSlice(style->borderImage());
case CSSPropertyBorderImageWidth:
- return valueForNinePieceImageQuad(style->borderImage().borderSlices(), style.get());
+ return valueForNinePieceImageQuad(style->borderImage().borderSlices(), *style);
case CSSPropertyWebkitMaskBoxImage:
- return valueForNinePieceImage(style->maskBoxImage(), style.get());
+ return valueForNinePieceImage(style->maskBoxImage(), *style);
case CSSPropertyWebkitMaskBoxImageOutset:
- return valueForNinePieceImageQuad(style->maskBoxImage().outset(), style.get());
+ return valueForNinePieceImageQuad(style->maskBoxImage().outset(), *style);
case CSSPropertyWebkitMaskBoxImageRepeat:
return valueForNinePieceImageRepeat(style->maskBoxImage());
case CSSPropertyWebkitMaskBoxImageSlice:
return valueForNinePieceImageSlice(style->maskBoxImage());
case CSSPropertyWebkitMaskBoxImageWidth:
- return valueForNinePieceImageQuad(style->maskBoxImage().borderSlices(), style.get());
+ return valueForNinePieceImageQuad(style->maskBoxImage().borderSlices(), *style);
case CSSPropertyWebkitMaskBoxImageSource:
if (style->maskBoxImageSource())
return style->maskBoxImageSource()->cssValue();
case CSSPropertyWebkitMarginTopCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
return cssValuePool().createValue(style->marginBeforeCollapse());
+ case CSSPropertyPerspective:
case CSSPropertyWebkitPerspective:
if (!style->hasPerspective())
return cssValuePool().createIdentifierValue(CSSValueNone);
- return zoomAdjustedPixelValue(style->perspective(), style.get());
+ return zoomAdjustedPixelValue(style->perspective(), *style);
+ case CSSPropertyPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOrigin: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
LayoutRect box;
if (renderer->isBox())
box = toRenderBox(renderer)->borderBoxRect();
- 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()));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width()), *style));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height()), *style));
}
else {
- list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
- list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get()));
+ list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), *style));
+ list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), *style));
}
return list.release();
case CSSPropertyWebkitRtlOrdering:
return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
case CSSPropertyWebkitTapHighlightColor:
- return currentColorOrValidColor(style.get(), style->tapHighlightColor());
+ return currentColorOrValidColor(*style, style->tapHighlightColor());
case CSSPropertyWebkitUserDrag:
return cssValuePool().createValue(style->userDrag());
case CSSPropertyWebkitUserSelect:
return cssValuePool().createValue(style->userSelect());
case CSSPropertyBorderBottomLeftRadius:
- return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), style.get());
+ return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), *style);
case CSSPropertyBorderBottomRightRadius:
- return valueForBorderRadiusCorner(style->borderBottomRightRadius(), style.get());
+ return valueForBorderRadiusCorner(style->borderBottomRightRadius(), *style);
case CSSPropertyBorderTopLeftRadius:
- return valueForBorderRadiusCorner(style->borderTopLeftRadius(), style.get());
+ return valueForBorderRadiusCorner(style->borderTopLeftRadius(), *style);
case CSSPropertyBorderTopRightRadius:
- return valueForBorderRadiusCorner(style->borderTopRightRadius(), style.get());
+ return valueForBorderRadiusCorner(style->borderTopRightRadius(), *style);
case CSSPropertyClip: {
- if (!style->hasClip())
+ if (style->hasAutoClip())
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()));
+ RefPtrWillBeRawPtr<Rect> rect = Rect::create();
+ rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), *style));
+ rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), *style));
+ rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), *style));
+ rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), *style));
return cssValuePool().createValue(rect.release());
}
case CSSPropertySpeak:
return cssValuePool().createValue(style->speak());
+ case CSSPropertyTransform:
case CSSPropertyWebkitTransform:
- return computedTransform(renderer, style.get());
+ return computedTransform(renderer, *style);
+ case CSSPropertyTransformOrigin:
case CSSPropertyWebkitTransformOrigin: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
LayoutRect box;
if (renderer->isBox())
box = toRenderBox(renderer)->borderBoxRect();
- 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()));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width()), *style));
+ list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height()), *style));
if (style->transformOriginZ() != 0)
- list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), *style));
} else {
- list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get()));
- list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get()));
+ list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), *style));
+ list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), *style));
if (style->transformOriginZ() != 0)
- list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
+ list->append(zoomAdjustedPixelValue(style->transformOriginZ(), *style));
}
return list.release();
}
+ case CSSPropertyTransformStyle:
case CSSPropertyWebkitTransformStyle:
return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
case CSSPropertyTransitionDelay:
return valueForAnimationTimingFunction(style->transitions());
case CSSPropertyTransition:
case CSSPropertyWebkitTransition: {
- const CSSAnimationDataList* animList = style->transitions();
- if (animList) {
- RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
- for (size_t i = 0; i < animList->size(); ++i) {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- const CSSAnimationData* animation = animList->animation(i);
- list->append(createTransitionPropertyValue(animation));
- list->append(cssValuePool().createValue(animation->duration(), CSSPrimitiveValue::CSS_S));
- list->append(createTimingFunctionValue(animation->timingFunction()));
- list->append(cssValuePool().createValue(animation->delay(), CSSPrimitiveValue::CSS_S));
+ const CSSTransitionData* transitionData = style->transitions();
+ if (transitionData) {
+ RefPtrWillBeRawPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
+ for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(createTransitionPropertyValue(transitionData->propertyList()[i]));
+ list->append(cssValuePool().createValue(CSSTimingData::getRepeated(transitionData->durationList(), i), CSSPrimitiveValue::CSS_S));
+ list->append(createTimingFunctionValue(CSSTimingData::getRepeated(transitionData->timingFunctionList(), i).get()));
+ list->append(cssValuePool().createValue(CSSTimingData::getRepeated(transitionData->delayList(), i), CSSPrimitiveValue::CSS_S));
transitionsList->append(list);
}
return transitionsList.release();
}
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// transition-property default value.
list->append(cssValuePool().createIdentifierValue(CSSValueAll));
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
- list->append(createTimingFunctionValue(CSSAnimationData::initialAnimationTimingFunction().get()));
- list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
+ list->append(cssValuePool().createValue(CSSTransitionData::initialDuration(), CSSPrimitiveValue::CSS_S));
+ list->append(createTimingFunctionValue(CSSTransitionData::initialTimingFunction().get()));
+ list->append(cssValuePool().createValue(CSSTransitionData::initialDelay(), CSSPrimitiveValue::CSS_S));
return list.release();
}
case CSSPropertyPointerEvents:
return cssValuePool().createValue(style->pointerEvents());
- case CSSPropertyWebkitLineGrid:
- if (style->lineGrid().isNull())
- 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());
case CSSPropertyWebkitTextCombine:
case CSSPropertyWebkitLineBoxContain:
return createLineBoxContainValue(style->lineBoxContain());
case CSSPropertyContent:
- return valueForContentData(style.get());
+ return valueForContentData(*style);
case CSSPropertyCounterIncrement:
- return valueForCounterDirectives(style.get(), propertyID);
+ return valueForCounterDirectives(*style, propertyID);
case CSSPropertyCounterReset:
- return valueForCounterDirectives(style.get(), propertyID);
+ return valueForCounterDirectives(*style, propertyID);
case CSSPropertyWebkitClipPath:
if (ClipPathOperation* operation = style->clipPath()) {
- if (operation->getOperationType() == ClipPathOperation::SHAPE)
- return valueForBasicShape(style.get(), static_cast<ShapeClipPathOperation*>(operation)->basicShape());
- if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
- ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation);
- return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI);
- }
+ if (operation->type() == ClipPathOperation::SHAPE)
+ return valueForBasicShape(*style, toShapeClipPathOperation(operation)->basicShape());
+ if (operation->type() == ClipPathOperation::REFERENCE)
+ return CSSPrimitiveValue::create(toReferenceClipPathOperation(operation)->url(), CSSPrimitiveValue::CSS_URI);
}
return cssValuePool().createIdentifierValue(CSSValueNone);
- case CSSPropertyWebkitFlowInto:
- 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);
- case CSSPropertyWebkitRegionFragment:
- return cssValuePool().createValue(style->regionFragment());
- case CSSPropertyWebkitWrapFlow:
- return cssValuePool().createValue(style->wrapFlow());
case CSSPropertyShapeMargin:
- return cssValuePool().createValue(style->shapeMargin());
- case CSSPropertyShapePadding:
- return cssValuePool().createValue(style->shapePadding());
+ return cssValuePool().createValue(style->shapeMargin(), *style);
case CSSPropertyShapeImageThreshold:
return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
- case CSSPropertyShapeInside:
- if (!style->shapeInside())
- return cssValuePool().createIdentifierValue(CSSValueAuto);
- if (style->shapeInside()->type() == ShapeValue::Outside)
- return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
- if (style->shapeInside()->type() == ShapeValue::Image) {
- if (style->shapeInside()->image())
- return style->shapeInside()->image()->cssValue();
- return cssValuePool().createIdentifierValue(CSSValueNone);
- }
- ASSERT(style->shapeInside()->type() == ShapeValue::Shape);
- return valueForBasicShape(style.get(), style->shapeInside()->shape());
case CSSPropertyShapeOutside:
- if (!style->shapeOutside())
- return cssValuePool().createIdentifierValue(CSSValueAuto);
- if (style->shapeOutside()->type() == ShapeValue::Image) {
- if (style->shapeOutside()->image())
- return style->shapeOutside()->image()->cssValue();
- return cssValuePool().createIdentifierValue(CSSValueNone);
- }
- ASSERT(style->shapeOutside()->type() == ShapeValue::Shape);
- return valueForBasicShape(style.get(), style->shapeOutside()->shape());
- case CSSPropertyWebkitWrapThrough:
- return cssValuePool().createValue(style->wrapThrough());
+ return valueForShape(*style, style->shapeOutside());
case CSSPropertyWebkitFilter:
- return valueForFilter(renderer, style.get());
+ return valueForFilter(renderer, *style);
case CSSPropertyMixBlendMode:
return cssValuePool().createValue(style->blendMode());
case CSSPropertyBackgroundBlendMode: {
- const FillLayer* layers = style->backgroundLayers();
- if (!layers->next())
- return cssValuePool().createValue(layers->blendMode());
-
- RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = &style->backgroundLayers(); currLayer; currLayer = currLayer->next())
list->append(cssValuePool().createValue(currLayer->blendMode()));
-
return list.release();
}
case CSSPropertyBackground:
return valuesForBackgroundShorthand();
case CSSPropertyBorder: {
- RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);
const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
CSSPropertyBorderLeft };
for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
if (!compareCSSValuePtr<CSSValue>(value, getPropertyCSSValue(properties[i], DoNotUpdateLayout)))
- return 0;
+ return nullptr;
}
return value.release();
}
case CSSPropertyBorderLeft:
return valuesForShorthandProperty(borderLeftShorthand());
case CSSPropertyBorderImage:
- return valueForNinePieceImage(style->borderImage(), style.get());
+ return valueForNinePieceImage(style->borderImage(), *style);
case CSSPropertyBorderRadius:
- return valueForBorderRadiusShorthand(style.get());
+ return valueForBorderRadiusShorthand(*style);
case CSSPropertyBorderRight:
return valuesForShorthandProperty(borderRightShorthand());
case CSSPropertyBorderStyle:
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
break;
- case CSSPropertyInternalCallback:
- // This property is hidden from the web.
- return 0;
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
case CSSPropertyWebkitTextEmphasis:
- case CSSPropertyTextLineThroughColor:
- case CSSPropertyTextLineThroughMode:
- case CSSPropertyTextLineThroughStyle:
- case CSSPropertyTextLineThroughWidth:
- case CSSPropertyTextOverlineColor:
- case CSSPropertyTextOverlineMode:
- case CSSPropertyTextOverlineStyle:
- case CSSPropertyTextOverlineWidth:
- case CSSPropertyTextUnderlineColor:
- case CSSPropertyTextUnderlineMode:
- case CSSPropertyTextUnderlineStyle:
- case CSSPropertyTextUnderlineWidth:
break;
/* Directional properties are resolved by resolveDirectionAwareProperty() before the switch. */
break;
/* Unimplemented @font-face properties */
- case CSSPropertyFontStretch:
case CSSPropertySrc:
case CSSPropertyUnicodeRange:
break;
case CSSPropertyInternalMarqueeSpeed:
case CSSPropertyInternalMarqueeStyle:
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
case CSSPropertyBufferedRendering:
case CSSPropertyClipPath:
case CSSPropertyStopOpacity:
case CSSPropertyColorInterpolation:
case CSSPropertyColorInterpolationFilters:
- case CSSPropertyColorProfile:
case CSSPropertyColorRendering:
case CSSPropertyFill:
case CSSPropertyFillOpacity:
case CSSPropertyDominantBaseline:
case CSSPropertyGlyphOrientationHorizontal:
case CSSPropertyGlyphOrientationVertical:
- case CSSPropertyKerning:
case CSSPropertyTextAnchor:
case CSSPropertyVectorEffect:
case CSSPropertyPaintOrder:
case CSSPropertyWritingMode:
return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout);
+
+ case CSSPropertyAll:
+ return nullptr;
}
logUnimplementedPropertyID(propertyID);
- return 0;
+ return nullptr;
}
String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
{
- RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID);
if (value)
return value->cssText();
return "";
unsigned CSSComputedStyleDeclaration::length() const
{
- Node* node = m_node.get();
- if (!node)
- return 0;
-
- RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
- if (!style)
+ if (!m_node || !m_node->inActiveDocument())
return 0;
-
return computableProperties().size();
}
return true;
}
}
- RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID);
return value && propertyValue && value->equals(*propertyValue);
}
-PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyProperties() const
+PassRefPtrWillBeRawPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyProperties() const
{
return copyPropertiesInSet(computableProperties());
}
-PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForShorthandProperty(const StylePropertyShorthand& shorthand) const
+PassRefPtrWillBeRawPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForShorthandProperty(const StylePropertyShorthand& shorthand) const
{
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
- RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i], DoNotUpdateLayout);
list->append(value);
}
return list.release();
}
-PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
+PassRefPtrWillBeRawPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
{
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// Assume the properties are in the usual order top, right, bottom, left.
- RefPtr<CSSValue> topValue = getPropertyCSSValue(shorthand.properties()[0], DoNotUpdateLayout);
- RefPtr<CSSValue> rightValue = getPropertyCSSValue(shorthand.properties()[1], DoNotUpdateLayout);
- RefPtr<CSSValue> bottomValue = getPropertyCSSValue(shorthand.properties()[2], DoNotUpdateLayout);
- RefPtr<CSSValue> leftValue = getPropertyCSSValue(shorthand.properties()[3], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> topValue = getPropertyCSSValue(shorthand.properties()[0], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> rightValue = getPropertyCSSValue(shorthand.properties()[1], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> bottomValue = getPropertyCSSValue(shorthand.properties()[2], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> leftValue = getPropertyCSSValue(shorthand.properties()[3], DoNotUpdateLayout);
// All 4 properties must be specified.
if (!topValue || !rightValue || !bottomValue || !leftValue)
- return 0;
+ return nullptr;
bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
return list.release();
}
-PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForGridShorthand(const StylePropertyShorthand& shorthand) const
+PassRefPtrWillBeRawPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForGridShorthand(const StylePropertyShorthand& shorthand) const
{
- RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
- RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i], DoNotUpdateLayout);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i], DoNotUpdateLayout);
list->append(value.release());
}
return list.release();
}
-PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
+PassRefPtrWillBeRawPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
{
- Vector<CSSProperty, 256> list;
+ WillBeHeapVector<CSSProperty, 256> list;
list.reserveInitialCapacity(properties.size());
for (unsigned i = 0; i < properties.size(); ++i) {
- RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]);
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]);
if (value)
list.append(CSSProperty(properties[i], value.release(), false));
}
return 0;
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
{
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
- return 0;
- RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
- return value ? value->cloneForCSSOM() : 0;
+ return nullptr;
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID);
+ return value ? value->cloneForCSSOM() : nullptr;
}
String CSSComputedStyleDeclaration::getPropertyValue(const String& propertyName)
{
CSSPropertyID propertyID = cssPropertyID(propertyName);
- if (!propertyID || !RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID))
+ if (!propertyID)
return String();
+ ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID));
return getPropertyValue(propertyID);
}
return false;
}
-void CSSComputedStyleDeclaration::setProperty(const String& name, const String&, const String&, ExceptionState& es)
+void CSSComputedStyleDeclaration::setProperty(const String& name, const String&, const String&, ExceptionState& exceptionState)
{
- es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + name + "' property on a computed 'CSSStyleDeclaration': computed styles are read-only.");
+ exceptionState.throwDOMException(NoModificationAllowedError, "These styles are computed, and therefore the '" + name + "' property is read-only.");
}
-String CSSComputedStyleDeclaration::removeProperty(const String& name, ExceptionState& es)
+String CSSComputedStyleDeclaration::removeProperty(const String& name, ExceptionState& exceptionState)
{
- es.throwDOMException(NoModificationAllowedError, "Failed to remove the '" + name + "' property from a computed 'CSSStyleDeclaration': computed styles are read-only.");
+ exceptionState.throwDOMException(NoModificationAllowedError, "These styles are computed, and therefore the '" + name + "' property is read-only.");
return String();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
+PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
{
return getPropertyCSSValue(propertyID);
}
return getPropertyValue(propertyID);
}
-void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID id, const String&, bool, ExceptionState& es)
-{
- es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + getPropertyNameString(id) + "' property on a computed 'CSSStyleDeclaration': computed styles are read-only.");
-}
-
-const HashMap<AtomicString, String>* CSSComputedStyleDeclaration::variableMap() const
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- Node* styledNode = this->styledNode();
- if (!styledNode)
- return 0;
- RefPtr<RenderStyle> style = styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : m_pseudoElementSpecifier);
- if (!style)
- return 0;
- return style->variables();
-}
-
-unsigned CSSComputedStyleDeclaration::variableCount() const
+void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID id, const String&, bool, ExceptionState& exceptionState)
{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- const HashMap<AtomicString, String>* variables = variableMap();
- if (!variables)
- return 0;
- return variables->size();
+ exceptionState.throwDOMException(NoModificationAllowedError, "These styles are computed, and therefore the '" + getPropertyNameString(id) + "' property is read-only.");
}
-String CSSComputedStyleDeclaration::variableValue(const AtomicString& name) const
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- const HashMap<AtomicString, String>* variables = variableMap();
- if (!variables)
- return emptyString();
- HashMap<AtomicString, String>::const_iterator it = variables->find(name);
- if (it == variables->end())
- return emptyString();
- return it->value;
-}
-
-bool CSSComputedStyleDeclaration::setVariableValue(const AtomicString& name, const String&, ExceptionState& es)
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + name + "' property on a computed 'CSSStyleDeclaration': computed styles are read-only.");
- return false;
-}
-
-bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- return false;
-}
-
-bool CSSComputedStyleDeclaration::clearVariables(ExceptionState& es)
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- es.throwDOMException(NoModificationAllowedError, "Failed to clear variables from a computed 'CSSStyleDeclaration': computed styles are read-only.");
- return false;
-}
-
-CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::ComputedCSSVariablesIterator(const HashMap<AtomicString, String>* variables)
- : m_active(variables)
-{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
- if (m_active) {
- m_it = variables->begin();
- m_end = variables->end();
- }
-}
-
-void CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::advance()
-{
- ASSERT(m_active);
- ++m_it;
- m_active = !atEnd();
-}
-
-AtomicString CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::name() const
-{
- ASSERT(m_active);
- return m_it->key;
-}
-
-String CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::value() const
-{
- ASSERT(m_active);
- return m_it->value;
-}
-
-PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShorthand() const
+PassRefPtrWillBeRawPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShorthand() const
{
static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,
static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyBackgroundSize, CSSPropertyBackgroundOrigin,
CSSPropertyBackgroundClip };
- RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
return list.release();
}
-} // namespace WebCore
+void CSSComputedStyleDeclaration::trace(Visitor* visitor)
+{
+ visitor->trace(m_node);
+ CSSStyleDeclaration::trace(visitor);
+}
+
+} // namespace blink