#include "config.h"
#include "core/css/CSSComputedStyleDeclaration.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/CSSGridLineNamesValue.h"
#include "core/css/CSSGridTemplateAreasValue.h"
#include "core/css/CSSLineBoxContainValue.h"
-#include "core/css/parser/BisonCSSParser.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/CSSValuePool.h"
#include "core/css/Pair.h"
#include "core/css/Rect.h"
-#include "core/css/RuntimeCSSEnabled.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 "platform/fonts/FontFeatureSettings.h"
#include "wtf/text/StringBuilder.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
CSSPropertyFontFamily,
CSSPropertyFontKerning,
CSSPropertyFontSize,
+ CSSPropertyFontStretch,
CSSPropertyFontStyle,
CSSPropertyFontVariant,
CSSPropertyFontVariantLigatures,
CSSPropertyHeight,
CSSPropertyImageRendering,
CSSPropertyIsolation,
+ CSSPropertyJustifyItems,
CSSPropertyJustifySelf,
CSSPropertyLeft,
CSSPropertyLetterSpacing,
CSSPropertyWebkitUserSelect,
CSSPropertyWebkitWritingMode,
CSSPropertyWebkitAppRegion,
- CSSPropertyWebkitWrapFlow,
- CSSPropertyWebkitWrapThrough,
CSSPropertyBufferedRendering,
CSSPropertyClipPath,
CSSPropertyClipRule,
{
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;
}
return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask(), style));
}
-static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle& style)
+static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer& layer, const RenderStyle& style)
{
RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
- if (layer->isBackgroundXOriginSet()) {
+ if (layer.isBackgroundXOriginSet()) {
ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
- positionList->append(cssValuePool().createValue(layer->backgroundXOrigin()));
+ positionList->append(cssValuePool().createValue(layer.backgroundXOrigin()));
}
- positionList->append(zoomAdjustedPixelValueForLength(layer->xPosition(), style));
- if (layer->isBackgroundYOriginSet()) {
+ positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), style));
+ if (layer.isBackgroundYOriginSet()) {
ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
- positionList->append(cssValuePool().createValue(layer->backgroundYOrigin()));
+ positionList->append(cssValuePool().createValue(layer.backgroundYOrigin()));
}
- positionList->append(zoomAdjustedPixelValueForLength(layer->yPosition(), style));
+ positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), style));
return positionList.release();
}
{
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);
}
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (renderer && renderer->isRenderGrid()) {
+ 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));
}
case TimingFunction::StepsFunction:
{
const StepsTimingFunction* stepsTimingFunction = toStepsTimingFunction(timingFunction);
- if (stepsTimingFunction->subType() == StepsTimingFunction::Custom)
- return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtPosition());
+ StepsTimingFunction::StepAtPosition position = stepsTimingFunction->stepAtPosition();
+ int steps = stepsTimingFunction->numberOfSteps();
+ ASSERT(position == StepsTimingFunction::Start || position == StepsTimingFunction::End);
- CSSValueID valueId;
- switch (stepsTimingFunction->subType()) {
- case StepsTimingFunction::Start:
- valueId = CSSValueStepStart;
- break;
- case StepsTimingFunction::End:
- valueId = CSSValueStepEnd;
- break;
- default:
- ASSERT_NOT_REACHED();
- return nullptr;
- }
+ if (steps > 1)
+ return CSSStepsTimingFunctionValue::create(steps, position);
+ CSSValueID valueId = position == StepsTimingFunction::Start ? CSSValueStepStart : CSSValueStepEnd;
return cssValuePool().createIdentifierValue(valueId);
}
{
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 (i)
result.append(' ');
result.append(getPropertyName(properties[i]));
- result.append(": ", 2);
+ result.appendLiteral(": ");
result.append(getPropertyValue(properties[i]));
result.append(';');
}
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();
}
PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowData(const ShadowData& shadow, const RenderStyle& style, bool useSpread) const
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));
+ }
}
return list.release();
}
return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), style);
}
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle& style)
+{
+ return cssValuePool().createValue(style.fontDescription().stretch());
+}
+
static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style)
{
- if (style.fontDescription().style() == FontStyleItalic)
- return cssValuePool().createIdentifierValue(CSSValueItalic);
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createValue(style.fontDescription().style());
}
static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(RenderStyle& style)
{
- if (style.fontDescription().variant() == FontVariantSmallCaps)
- return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createValue(style.fontDescription().variant());
}
static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(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);
- }
- ASSERT_NOT_REACHED();
- return cssValuePool().createIdentifierValue(CSSValueNormal);
+ return cssValuePool().createValue(style.fontDescription().weight());
}
static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const RenderStyle& style, ShapeValue* shapeValue)
}
}
-PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle(CSSPropertyID propertyID) const
+PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle() const
{
Node* styledNode = this->styledNode();
ASSERT(styledNode);
return m_node.get();
}
-static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment)
+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();
}
styledNode = this->styledNode();
renderer = styledNode->renderer();
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
bool forceFullLayout = isLayoutDependent(propertyID, style, renderer)
|| styledNode->isInShadowTree()
if (forceFullLayout) {
document.updateLayoutIgnorePendingStylesheets();
styledNode = this->styledNode();
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
renderer = styledNode->renderer();
}
} else {
- style = computeRenderStyle(propertyID);
+ style = computeRenderStyle();
}
if (!style)
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);
- }
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ 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);
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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());
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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());
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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());
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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());
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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);
- }
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ 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);
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
- list->append(createPositionListForLayer(propertyID, currLayer, *style));
+ 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 zoomAdjustedPixelValueForLength(layers->xPosition(), *style);
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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 zoomAdjustedPixelValueForLength(layers->yPosition(), *style);
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ 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(CSSValueAuto);
return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyColumnFill:
- if (RuntimeEnabledFeatures::regionBasedColumnsEnabled())
- return cssValuePool().createValue(style->columnFill());
- return nullptr;
+ ASSERT(RuntimeEnabledFeatures::regionBasedColumnsEnabled());
+ return cssValuePool().createValue(style->columnFill());
case CSSPropertyWebkitColumnGap:
if (style->hasNormalColumnGap())
return cssValuePool().createIdentifierValue(CSSValueNormal);
case CSSPropertyAlignContent:
return cssValuePool().createValue(style->alignContent());
case CSSPropertyAlignItems:
- return valueForItemPositionWithOverflowAlignment(style->alignItems(), style->alignItemsOverflowAlignment());
- case CSSPropertyAlignSelf: {
- ItemPosition alignSelf = style->alignSelf();
- if (alignSelf == ItemPositionAuto) {
- Node* parent = styledNode->parentNode();
- if (parent && parent->computedStyle())
- alignSelf = parent->computedStyle()->alignItems();
- else
- alignSelf = ItemPositionStretch;
- }
- return valueForItemPositionWithOverflowAlignment(alignSelf, style->alignSelfOverflowAlignment());
- }
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLegacyPosition);
+ case CSSPropertyAlignSelf:
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignment(), NonLegacyPosition);
case CSSPropertyFlex:
return valuesForShorthandProperty(flexShorthand());
case CSSPropertyFlexBasis:
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);
}
case CSSPropertyFontSize:
return valueForFontSize(*style);
+ case CSSPropertyFontStretch:
+ return valueForFontStretch(*style);
case CSSPropertyFontStyle:
return valueForFontStyle(*style);
case CSSPropertyFontVariant:
}
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
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(style->justifySelf(), style->justifySelfOverflowAlignment());
+ return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAlignment(), NonLegacyPosition);
case CSSPropertyLeft:
return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
case CSSPropertyLetterSpacing:
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);
}
case CSSPropertyMaxWidth: {
const Length& maxWidth = style->maxWidth();
- if (maxWidth.isUndefined())
+ if (maxWidth.isMaxSizeNone())
return cssValuePool().createIdentifierValue(CSSValueNone);
return zoomAdjustedPixelValueForLength(maxWidth, *style);
}
case CSSPropertyBorderTopRightRadius:
return valueForBorderRadiusCorner(style->borderTopRightRadius(), *style);
case CSSPropertyClip: {
- if (!style->hasClip())
+ if (style->hasAutoClip())
return cssValuePool().createIdentifierValue(CSSValueAuto);
RefPtrWillBeRawPtr<Rect> rect = Rect::create();
rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), *style));
return CSSPrimitiveValue::create(toReferenceClipPathOperation(operation)->url(), CSSPrimitiveValue::CSS_URI);
}
return cssValuePool().createIdentifierValue(CSSValueNone);
- case CSSPropertyWebkitWrapFlow:
- return cssValuePool().createValue(style->wrapFlow());
case CSSPropertyShapeMargin:
return cssValuePool().createValue(style->shapeMargin(), *style);
case CSSPropertyShapeImageThreshold:
return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyShapeOutside:
return valueForShape(*style, style->shapeOutside());
- case CSSPropertyWebkitWrapThrough:
- return cssValuePool().createValue(style->wrapThrough());
case CSSPropertyWebkitFilter:
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());
-
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ for (const FillLayer* currLayer = &style->backgroundLayers(); currLayer; currLayer = currLayer->next())
list->append(cssValuePool().createValue(currLayer->blendMode()));
-
return list.release();
}
case CSSPropertyBackground:
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
break;
- case CSSPropertyInternalCallback:
- // This property is hidden from the web.
- return nullptr;
/* 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;
unsigned CSSComputedStyleDeclaration::length() const
{
- Node* node = m_node.get();
- if (!node)
+ if (!m_node || !m_node->inActiveDocument())
return 0;
-
- RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
- if (!style)
- return 0;
-
return computableProperties().size();
}
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);
}
CSSStyleDeclaration::trace(visitor);
}
-} // namespace WebCore
+} // namespace blink